#pragma once

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

struct XRefRecord
{
    std::size_t mOffsetBytes{0};
    std::size_t mGenerationNumber{0};
    bool mIsFree{false};
};

struct TableSubSection
{
    std::size_t mStartIndex{0};
    std::vector<XRefRecord> mRecords;
};

class PdfXRefTable
{
public:
    PdfXRefTable();

    void addRecord(std::size_t numBytes, std::size_t generation, unsigned isFree);

    std::size_t getNextOffset();

    std::size_t getNumEntries();

    std::string toString();
private:
    std::size_t mLastAddedBytes{0};
    std::vector<TableSubSection> mSections;
};
