#pragma once
#include "Def.h"

namespace Generated
{
    struct PuzzleElementType
    {
        static constexpr uint32_t Hash = 2024002654;
        static constexpr int32_t EntryCount = 8;
        enum Enum : int32_t
        {
            None,
            WaterIn,
            WaterGoal,
            WaterChannel,
            ElectricIn,
            ElectricGoal,
            Blocked,
            Bridge,
        };
        static constexpr char EntryNames[EntryCount][64]
        {
            "None",
            "WaterIn",
            "WaterGoal",
            "WaterChannel",
            "ElectricIn",
            "ElectricGoal",
            "Blocked",
            "Bridge",
        };
        static constexpr char GameName[EntryCount][64]
        {
            "Empty",
            "Water Source",
            "Water Goal",
            "Water Channel",
            "Electricity Source",
            "Electricity Goal",
            "Blocked",
            "Bridge",
        };
        static constexpr char ShortName[EntryCount][64]
        {
            "  ",
            "~+",
            "~!",
            "~",
            "e+",
            "e!",
            "B",
            "#",
        };
    };
    struct Vec2
    {
        static constexpr uint32_t Hash = 4242122113;
        float X = {};
        float Y = {};
    };
    struct Vec3
    {
        static constexpr uint32_t Hash = 1694997017;
        float X = {};
        float Y = {};
        float Z = {};
    };
    struct Vec4
    {
        static constexpr uint32_t Hash = 447058821;
        float X = {};
        float Y = {};
        float Z = {};
        float W = {};
    };
    struct Mat3
    {
        static constexpr uint32_t Hash = 3364737048;
        float M[9] = {
	1.0f, 0.0f, 0.0f,
	0.0f, 1.0f, 0.0f,
	0.0f, 0.0f, 1.0f
	};
    };
    struct Mat4
    {
        static constexpr uint32_t Hash = 1650094019;
        float M[16] = {
	1.0f, 0.0f, 0.0f, 0.0f,
	0.0f, 1.0f, 0.0f, 0.0f,
	0.0f, 0.0f, 1.0f, 0.0f,
	0.0f, 0.0f, 0.0f, 1.0f
	};
    };
    struct AssetHandle
    {
        static constexpr uint32_t Hash = 2609735487;
        uint32_t Idx = UINT32_MAX;
    };
    struct ModelHandle
    {
        static constexpr uint32_t Hash = 298089627;
        uint16_t ModelIdx = UINT16_MAX;
        AssetHandle Asset = {};
    };
    struct TextureHandle
    {
        static constexpr uint32_t Hash = 1633273761;
        uint16_t TextureIdx = UINT16_MAX;
        AssetHandle Asset = {};
    };
    struct PuzPos
    {
        static constexpr uint32_t Hash = 1834398141;
        int8_t X = {};
        int8_t Y = {};
    };
    struct StaticPuzzleCard
    {
        static constexpr uint32_t Hash = 431895198;
        PuzzleElementType::Enum Elements[4] = {};
        ModelHandle ModelHandle = {};
        TextureHandle BoardTextureHandle = {};
    };
    struct StaticPuzzleCardHandle
    {
        static constexpr uint32_t Hash = 1742502768;
        uint16_t Idx = UINT16_MAX;
    };
    struct StaticPuzzleData
    {
        static constexpr uint32_t Hash = 1497693577;
        StaticPuzzleCard Cards[64] = {};
    };
    struct PuzzleCardStack
    {
        static constexpr uint32_t Hash = 53538532;
        StaticPuzzleCardHandle RefCard = {};
        uint8_t MaxAvailableCount = {};
        uint8_t UsedCount = {};
    };
    struct PlacedPuzzleCard
    {
        static constexpr uint32_t Hash = 3555575973;
        StaticPuzzleCardHandle RefCard = {};
        PuzPos Position = {};
        uint8_t Rotation = {};
        bool IsLocked = {};
    };
    struct PuzzleData
    {
        static constexpr uint32_t Hash = 657000000;
        uint16_t ID = {};
        char PuzzleName[64] = {};
        uint8_t WidthTiles = {};
        uint8_t HeightTiles = {};
        uint32_t AvailableCardCount = {};
        PuzzleCardStack AvailableCards[16] = {};
        PlacedPuzzleCard PlacedCards[256] = {};
        PuzzleElementType::Enum BackgroundTiles[1024] = {};
        uint32_t GoalPositionCount = {};
        PuzPos GoalPositions[16] = {};
    };
    bool Save(const PuzzleElementType::Enum* obj, uint32_t count, Serializer& serializer);
    bool Load(PuzzleElementType::Enum* obj, uint32_t count, Deserializer& serializer);
    bool Save(const Vec2* obj, uint32_t count, Serializer& serializer);
    bool Load(Vec2* obj, uint32_t count, Deserializer& serializer);
    bool Save(const Vec3* obj, uint32_t count, Serializer& serializer);
    bool Load(Vec3* obj, uint32_t count, Deserializer& serializer);
    bool Save(const Vec4* obj, uint32_t count, Serializer& serializer);
    bool Load(Vec4* obj, uint32_t count, Deserializer& serializer);
    bool Save(const Mat3* obj, uint32_t count, Serializer& serializer);
    bool Load(Mat3* obj, uint32_t count, Deserializer& serializer);
    bool Save(const Mat4* obj, uint32_t count, Serializer& serializer);
    bool Load(Mat4* obj, uint32_t count, Deserializer& serializer);
    bool Save(const AssetHandle* obj, uint32_t count, Serializer& serializer);
    bool Load(AssetHandle* obj, uint32_t count, Deserializer& serializer);
    bool Save(const ModelHandle* obj, uint32_t count, Serializer& serializer);
    bool Load(ModelHandle* obj, uint32_t count, Deserializer& serializer);
    bool Save(const TextureHandle* obj, uint32_t count, Serializer& serializer);
    bool Load(TextureHandle* obj, uint32_t count, Deserializer& serializer);
    bool Save(const PuzPos* obj, uint32_t count, Serializer& serializer);
    bool Load(PuzPos* obj, uint32_t count, Deserializer& serializer);
    bool Save(const StaticPuzzleCard* obj, uint32_t count, Serializer& serializer);
    bool Load(StaticPuzzleCard* obj, uint32_t count, Deserializer& serializer);
    bool Save(const StaticPuzzleCardHandle* obj, uint32_t count, Serializer& serializer);
    bool Load(StaticPuzzleCardHandle* obj, uint32_t count, Deserializer& serializer);
    bool Save(const StaticPuzzleData* obj, uint32_t count, Serializer& serializer);
    bool Load(StaticPuzzleData* obj, uint32_t count, Deserializer& serializer);
    bool Save(const PuzzleCardStack* obj, uint32_t count, Serializer& serializer);
    bool Load(PuzzleCardStack* obj, uint32_t count, Deserializer& serializer);
    bool Save(const PlacedPuzzleCard* obj, uint32_t count, Serializer& serializer);
    bool Load(PlacedPuzzleCard* obj, uint32_t count, Deserializer& serializer);
    bool Save(const PuzzleData* obj, uint32_t count, Serializer& serializer);
    bool Load(PuzzleData* obj, uint32_t count, Deserializer& serializer);
}
