#pragma once

#include "HttpHeader.h"
#include "HttpPreamble.h"

#include <string>

class HttpResponse
{
public:
    struct ClientError
    {
        std::string mMessage;
        int mCode{ -1 };
    };

    HttpResponse();

    ~HttpResponse();

    void fromMessage(const std::string& message);

    unsigned getBodyLength() const;

    const std::string& getBody() const;

    const HttpHeader& getHeader() const;

    std::string getHeaderString() const;

    std::string toString() const;

    unsigned short getStatusCode() const;

    const std::string& getResponseReason() const;

    void setStatusCode(unsigned short code);

    void setResponseReason(const std::string& reason);

    void setBody(const std::string& body);

    void setClientError(const ClientError& error);

private:
    HttpPreamble mPreamble;
    HttpHeader mHeader;

    ClientError mClientError;
    unsigned short mStatusCode{ 200 };
    std::string mResponseReason{ };
    std::string mBody;
};
