#ifndef __Terminal_h__
#define __Terminal_h__

#include "includes"
#include "TCPSession.h"
#include "TCPServer.h"

namespace core {

   static const int FG_BLACK = 30;
   static const int FG_RED = 31;
   static const int FG_GREEN = 32;
   static const int FG_YELLOW = 33;
   static const int FG_BLUE = 34;
   static const int FG_MAGENTA = 35;
   static const int FG_CYAN = 36;
   static const int FG_WHITE = 37;

   static const int BG_BLACK = 40;
   static const int BG_RED = 41;
   static const int BG_GREEN = 42;
   static const int BG_YELLOW = 43;
   static const int BG_BLUE = 44;
   static const int BG_MAGENTA = 45;
   static const int BG_CYAN = 46;
   static const int BG_WHITE = 47;

   static const char esc = 0x1b;

   class TerminalSession : public TCPSession {

    public:
      TerminalSession(EPoll &ePoll, TCPServer &server);
      ~TerminalSession();

      int getLines();

      ///
      /// Clear the display.
      ///

      void clear();

      ///
      /// Clear the display from the cursor to the end of line.
      ///

      void clearEOL();

      ///
      /// Set the location of the cursor on the display.
      ///

      void setCursorLocation(int x, int y);
      void setColor(int color);
      void setBackColor(int color);
      void saveCursor();
      void restoreCursor();
      void NextLine(int lines);
      void PreviousLine(int lines);
      void scrollArea(int start, int end);

   };

}

#endif
