#pragma once

#include "PngInfo.h"

#include <vector>

class PngHeader
{
public:
    uint32_t getLength() const;

    uint32_t getCrc();

    const std::vector<unsigned char>& getData() const;

    uint32_t getWidth() const
    {
        return mWidth;
    }

    uint32_t getHeight() const
    {
        return mHeight;
    }

    unsigned char getBitDepth() const
    {
        return mBitDepth;
    }

    const PngInfo& getPngInfo() const
    {
        return mPngInfo;
    }

    unsigned char getHighBitCheck() const;

    std::vector<unsigned char> getSignature() const;

    std::string getFileName() const;

    const std::string& getChunkName() const;

    void setPngInfo(const PngInfo& info);

    void setImageData(uint32_t width, uint32_t height, unsigned char bitDepth);

    std::string toString() const;

    void updateData();

private:
    uint32_t mWidth{0};
    uint32_t mHeight{0};
    unsigned char mBitDepth{0};
    PngInfo mPngInfo;
    std::string mName{"IHDR"};

    uint32_t mCachedCrc{0};

    std::vector<unsigned char> mData;
};
