#pragma once

#include "PdfDictionary.h"

#include <memory>
#include <string>
#include <vector>

class PdfDocumentCatalog;
using PdfDocumentCatalogPtr = std::unique_ptr<PdfDocumentCatalog>;

class PdfXRefTable;
using PdfXRefTablePtr = std::unique_ptr<PdfXRefTable>;

class PdfDocument
{
public:
    PdfDocument();
    ~PdfDocument();

    std::string toString();
private:
    std::string getHeaderString();

    std::string getTrailerString();

    std::string getBodyString();

    std::string getXRefString();

    void indexObjects();

private:
    PdfDictionary mTrailer;

    std::string mVersion {"1.7"};
    PdfXRefTablePtr mXRefTable;
    std::size_t mXRefOffset{0};
    PdfDocumentCatalogPtr mCatalog;
};

using PdfDocumentPtr = std::unique_ptr<PdfDocument>;
