#include <cstdint>

struct SerializationHeader
{
    uint8_t _ID0 = 0;
    uint8_t _ID1 = 0;
    uint8_t _ID2 = 0;
    uint8_t _ID3 = 0;
    uint8_t HeaderVersion = 0;
    uint8_t VersionNum = 0;
    uint8_t Reserved0 = 0;
    uint8_t Reserved1 = 0;
};

#define SER_HEADER(Version, FCC)                                                                                       \
    SerializationHeader __Header{                                                                                      \
        FCC[0],                                                                                                        \
        FCC[1],                                                                                                        \
        FCC[2],                                                                                                        \
        FCC[3],                                                                                                        \
        1,                                                                                                             \
        Version,                                                                                                       \
        0,                                                                                                             \
        0,                                                                                                             \
    };                                                                                                                 \
    bool VersionMatches(uint8_t headerVersion, uint8_t versionNum)                                                     \
    {                                                                                                                  \
        return headerVersion == 1 && versionNum == Version;                                                            \
    }

void SerializeStruct(void* data, uint64_t size, const char* path);
void DeserializeStruct(void* data, SerializationHeader& expectedHeader, const char* path);
