#pragma once

#include "PdfDictionary.h"
#include "StringUtils.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;
    unsigned mXRefOffset{0};
    PdfDocumentCatalogPtr mCatalog;
};

using PdfDocumentPtr = std::unique_ptr<PdfDocument>;
