#ifndef WEBCLIENT_H
#define WEBCLIENT_H

#include "WEBServer.h"
#include "TCPClient.h"
#include "Dictionary.h"

class WEBClient : public TCPClient
{
  template <typename T>
	friend class WEBServer;
	public:
		WEBClient(WiFiClient client, uint8_t id, uint16_t maxResourceBuffer = 255, uint16_t maxBodyBuffer = 255, uint16_t dataBufferSize = 511);
		virtual ~WEBClient();
	protected:
    WEBServer<WEBClient>::WEBClientState _WEBClientState;
	private:
    struct HttpRequestData
    {
      WEBServer<WEBClient>::HttpRequestMethod HRM;
      WEBServer<WEBClient>::HttpVersion HV;
      WEBServer<WEBClient>::HttpMIMEType HMT;
      
      Dictionary<DictionaryHelper::StringEntity> getParams;
      char *getParamsDataPointer; //Used in the getParams algorithm
      Dictionary<DictionaryHelper::StringEntity> postParams;
      char *postParamsDataPointer; //Used in the postParams algorithm
      
      char *httpResource;
      uint16_t maxResourceBuffer;
      char *httpBody;
      uint16_t maxBodyBuffer;
    } _httpRequestData;
    
    WEBServer<WEBClient>::HttpParserStatus _httpParserState;

    void clearHttpRequestData();
};

#endif //WEBCLIENT_H
