///////////////////////////////////////////////////////////
///////////////// Have an itch? Scratch it! ///////////////
///////////////////////// SCRATCH /////////////////////////
/////////////////////  A MUD  Server   ////////////////////
///////////////////// By: Jared Devall ////////////////////
/////////////////////      Thanks:     ////////////////////
/////////////////////  DIKU/Merc/ROM   ////////////////////
///////////////////// Aetas/Deus Gang  ////////////////////
/////////////////////       Beej       ////////////////////
///////////////////////////////////////////////////////////

#ifndef __AVATAR_H_
#define __AVATAR_H_

#include "socket.h"
#include "handler.h"
#include <deque>
#include <map>

enum STATUS { LOGIN, CONNECTED };

class Room;

class Char
{
  public:
         // to make my life easier, this is a public pointer
         Room   *     _room;
         
         //methods
   	     bool         SetName( const std::string & );
    	 std::string  Get( const std::string & );
	     bool         Set( const std::string &, const std::string & );

  private:
          std::map< std::string, std:: string > _info;
};


class Avatar : public Char
{
	Socket *    _socket;
	std::string _edit;
	bool        _gotInput;
	bool        _disconnected;
	STATUS      _status;

	// Private Handler Stuff
	void        PopHandler( void );
	
 public:

	typedef std::deque<Handler *> handlerStack;
				 Avatar( );
				 ~Avatar( );
	STATUS       GetStatus( void );
	void         SetStatus ( STATUS );
	void         Send( char *, ... );
	void         Send( const std::string & );
	Socket *     GetSocket( void );
	void         SetSocket( Socket * );
	bool         VerifyPassword( const std::string & );
	std::string  EncryptPassword( const std::string & );
	void         ClearPassword( void );
	void         SetEdit( const std::string & );
	std::string  GetEdit( void );
	bool         HasPassword( void );
	void         FlushOutput( void );
	void         SetDisconnected( bool value );
	bool         IsDisconnected( void );
	void         SetGotInput( bool value );
	bool         GotInput( void );
	bool         Load( void );
	bool         Save( void );
	bool         Create( void );
	bool         Delete( void );
    bool         Set( const std::string &, const std::string & );
	
	// Public Handler Stuff
	void	     StackHandler( Handler *);
	void		 ReplaceHandler( Handler *);
	void		 ExitHandler( void );
	void		 HandleInput( const std::string & );
	handlerStack _handlers;
	
};
#endif