#ifndef HTTPCONSTANTS_H
#define HTTPCONSTANTS_H

#define HTTPCONSTANTS_STRING //PSTR

class HttpConstants
{
  public:
    enum HttpRequestMethod {UNDEFINED, GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH};
    enum HttpVersion {UNKNOWN, HTTP_0_9, HTTP_1_1, HTTP_1_0, HTTP_2_0};
    enum HttpMIMEType { UNKNOWN_MIME,
                        TEXT_PLAIN,
                        TEXT_CSS,
                        TEXT_HTML,
                        TEXT_JAVASCRIPT,
                        APPLICATION_JSON,
                        APPLICATION_X_WWW_FORM_URLENCODED,
                        IMAGE_PNG,
                        IMAGE_JPEG,
                        IMAGE_X_ICO,
                        AUDIO_MPEG,
                        APPLICATION_OCTET_STREAM};
    enum HTTP_CODE {
                      UNDEFINED_CODE = 0,
                      HTTP_CODE_CONTINUE = 100,
                      HTTP_CODE_SWITCHING_PROTOCOLS = 101,
                      HTTP_CODE_PROCESSING = 102,
                      HTTP_CODE_OK = 200,
                      HTTP_CODE_CREATED = 201,
                      HTTP_CODE_ACCEPTED = 202,
                      HTTP_CODE_NON_AUTHORITATIVE_INFORMATION = 203,
                      HTTP_CODE_NO_CONTENT = 204,
                      HTTP_CODE_RESET_CONTENT = 205,
                      HTTP_CODE_PARTIAL_CONTENT = 206,
                      HTTP_CODE_MULTI_STATUS = 207,
                      HTTP_CODE_ALREADY_REPORTED = 208,
                      HTTP_CODE_IM_USED = 226,
                      HTTP_CODE_MULTIPLE_CHOICES = 300,
                      HTTP_CODE_MOVED_PERMANENTLY = 301,
                      HTTP_CODE_FOUND = 302,
                      HTTP_CODE_SEE_OTHER = 303,
                      HTTP_CODE_NOT_MODIFIED = 304,
                      HTTP_CODE_USE_PROXY = 305,
                      HTTP_CODE_TEMPORARY_REDIRECT = 307,
                      HTTP_CODE_PERMANENT_REDIRECT = 308,
                      HTTP_CODE_BAD_REQUEST = 400,
                      HTTP_CODE_UNAUTHORIZED = 401,
                      HTTP_CODE_PAYMENT_REQUIRED = 402,
                      HTTP_CODE_FORBIDDEN = 403,
                      HTTP_CODE_NOT_FOUND = 404,
                      HTTP_CODE_METHOD_NOT_ALLOWED = 405,
                      HTTP_CODE_NOT_ACCEPTABLE = 406,
                      HTTP_CODE_PROXY_AUTHENTICATION_REQUIRED = 407,
                      HTTP_CODE_REQUEST_TIMEOUT = 408,
                      HTTP_CODE_CONFLICT = 409,
                      HTTP_CODE_GONE = 410,
                      HTTP_CODE_LENGTH_REQUIRED = 411,
                      HTTP_CODE_PRECONDITION_FAILED = 412,
                      HTTP_CODE_PAYLOAD_TOO_LARGE = 413,
                      HTTP_CODE_URI_TOO_LONG = 414,
                      HTTP_CODE_UNSUPPORTED_MEDIA_TYPE = 415,
                      HTTP_CODE_RANGE_NOT_SATISFIABLE = 416,
                      HTTP_CODE_EXPECTATION_FAILED = 417,
                      HTTP_CODE_MISDIRECTED_REQUEST = 421,
                      HTTP_CODE_UNPROCESSABLE_ENTITY = 422,
                      HTTP_CODE_LOCKED = 423,
                      HTTP_CODE_FAILED_DEPENDENCY = 424,
                      HTTP_CODE_UPGRADE_REQUIRED = 426,
                      HTTP_CODE_PRECONDITION_REQUIRED = 428,
                      HTTP_CODE_TOO_MANY_REQUESTS = 429,
                      HTTP_CODE_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
                      HTTP_CODE_INTERNAL_SERVER_ERROR = 500,
                      HTTP_CODE_NOT_IMPLEMENTED = 501,
                      HTTP_CODE_BAD_GATEWAY = 502,
                      HTTP_CODE_SERVICE_UNAVAILABLE = 503,
                      HTTP_CODE_GATEWAY_TIMEOUT = 504,
                      HTTP_CODE_HTTP_VERSION_NOT_SUPPORTED = 505,
                      HTTP_CODE_VARIANT_ALSO_NEGOTIATES = 506,
                      HTTP_CODE_INSUFFICIENT_STORAGE = 507,
                      HTTP_CODE_LOOP_DETECTED = 508,
                      HTTP_CODE_NOT_EXTENDED = 510,
                      HTTP_CODE_NETWORK_AUTHENTICATION_REQUIRED = 511
                   };
	
	static const char *httpVersionToString(HttpVersion version)
	{
		switch(version)
		{
			case HttpVersion::HTTP_0_9:
        return HTTPCONSTANTS_STRING("HTTP/0.9");
				break;
			case HttpVersion::HTTP_1_0:
        return HTTPCONSTANTS_STRING("HTTP/1.0");
				break;
			case HttpVersion::HTTP_2_0:
        return HTTPCONSTANTS_STRING("HTTP/2.0");
				break;
			default:
        return HTTPCONSTANTS_STRING("HTTP/1.1");
				break;
		}
	}
	
	static const char *httpMIMETypeToString(HttpMIMEType m)
	{
    switch(m)
    {
      case HttpMIMEType::TEXT_PLAIN:
        return HTTPCONSTANTS_STRING("text/plain");
        break;
        case HttpMIMEType::TEXT_CSS:
        return HTTPCONSTANTS_STRING("text/css");
        break;
        case HttpMIMEType::TEXT_HTML:
        return HTTPCONSTANTS_STRING("text/html");
        break;
        case HttpMIMEType::TEXT_JAVASCRIPT:
        return HTTPCONSTANTS_STRING("text/javascript");
        break;
      case HttpMIMEType::APPLICATION_JSON:
        return HTTPCONSTANTS_STRING("application/json");
        break;
      case HttpMIMEType::APPLICATION_X_WWW_FORM_URLENCODED:
        return HTTPCONSTANTS_STRING("application/x-www-form-urlencoded");
        break;
      case HttpMIMEType::IMAGE_PNG:
        return HTTPCONSTANTS_STRING("image/png");
        break;
      case HttpMIMEType::IMAGE_JPEG:
        return HTTPCONSTANTS_STRING("image/jpeg");
        break;
      case HttpMIMEType::IMAGE_X_ICO:
        return HTTPCONSTANTS_STRING("image/x-icon");
        break;
      case HttpMIMEType::AUDIO_MPEG:
        return HTTPCONSTANTS_STRING("audio/mpeg");
        break;
      default:
        return HTTPCONSTANTS_STRING("application/octet-stream");
        break;
    }
	}
 
  static const char *httpStatusToString(HTTP_CODE c)
  {
    switch(c)
    {
      case HTTP_CODE_PARTIAL_CONTENT:
        return HTTPCONSTANTS_STRING("206 Partial Content");
        break;
      default:
        return HTTPCONSTANTS_STRING("200 OK");
    }
  }
  protected:
  private:
};

#endif//HTTPCONSTANTS_H
