/**
 * Copyright (c) 2016-2026 Governikus GmbH & Co. KG, Germany
 */

#pragma once

#include <QByteArray>
#include <QMap>
#include <llhttp.h>

namespace governikus
{

class HttpResponse
{
	private:
		llhttp_status mStatus;
		QMap<QByteArray, QByteArray> mHeader;
		QByteArray mBody;

		[[nodiscard]] QByteArray getStatusMessage() const;

	public:
		explicit HttpResponse(llhttp_status pStatus = HTTP_STATUS_INTERNAL_SERVER_ERROR,
				const QByteArray& pBody = QByteArray(),
				const QByteArray& pContentType = QByteArray());

		[[nodiscard]] QByteArray getHeader(const QByteArray& pKey) const;
		[[nodiscard]] const QMap<QByteArray, QByteArray>& getHeaders() const;
		void setHeader(const QByteArray& pKey, const QByteArray& pValue);

		[[nodiscard]] llhttp_status getStatus() const;
		void setStatus(llhttp_status pStatus);

		[[nodiscard]] const QByteArray& getBody() const;
		void setBody(const QByteArray& pBody, const QByteArray& pContentType = QByteArray());

		[[nodiscard]] QByteArray getMessage() const;
};

} // namespace governikus
