#ifndef TILE_NET_HTTP_HTTP_RESPONSE_H
#define TILE_NET_HTTP_HTTP_RESPONSE_H

#pragma once

#include "tile/base/string.h"
#include "tile/net/http/http_message.h"
#include "tile/net/http/types.h"

namespace tile {
class HttpResponse : private http::HttpMessage {
public:
    using HttpMessage::set_version;
    using HttpMessage::version;

    HttpStatus status() const noexcept { return status_; }

    void set_status(HttpStatus s) noexcept { status_ = s; }

    using HttpMessage::body;
    using HttpMessage::body_size;
    using HttpMessage::headers;
    using HttpMessage::noncontiguous_body;
    using HttpMessage::set_body;

    void clear() noexcept;
    std::string ToString() const;

private:
    HttpStatus status_{HttpStatus::OK};
};

void GenerateDefaultResponsePage(HttpStatus status, HttpResponse *response, Slice title = "", Slice body = "");

namespace http {
Slice GetStatusCodeWithDescString(HttpStatus status) noexcept;
}

}// namespace tile

#endif// TILE_NET_HTTP_HTTP_RESPONSE_H
