module Account {

  const long DAILY_MAX = 1000;

  typedef char Face[6][10];
  typedef fixed<16,2> Amount, Amounts[10];
#  typedef long Amount;

  interface AcctCounter {
    long next();
    void destroy();
  };

  interface BaseAccount {
    Object echo_object (in Object obj);
  };

  interface Account : BaseAccount {
    exception InsufficientFunds { Amount overdraft; };
    
    typedef sequence<short> numbers;

    enum Color {
      taupe, burgundy, chartreuse
    };
    struct Preferences {

      Color favorite_color;
      numbers lottery_numbers;
      string nickname;
    };

    enum PrefType {
      pt_color, pt_lotnum, pt_nickname
    };

    union Preference switch (PrefType) {
      case pt_color: Color favorite_color;
      case pt_lotnum: numbers lottery_numbers;
      case pt_nickname: string nickname;
    };
    
    attribute Preferences prefs;
    attribute Face appearance;
    readonly attribute string Foo;


    void set_pref ( in Preference p );
    Preference get_pref ( in PrefType t );
    any get_pref_any ( in PrefType t );

    void deposit( in Amount a );
    void withdraw( in Amount a ) raises (InsufficientFunds);
    long long add ( in long long a, in long long b );
    Amount balance();
    AcctCounter counter();
    void server_exit ();
  };
};
