#pragma once
#include "Gen/Generated.h"
#include <cstdint>

namespace Def
{
    constexpr int32_t MaxNameLength = 64;
    constexpr int32_t MaxFields = 64;
    constexpr int32_t MaxExtraEnumFields = 2;
    enum class EFieldType
    {
        Native,
        DefinedClass,
        DefinedEnum
    };
    struct FieldType
    {
        EFieldType FieldKind = EFieldType::Native;
        Generated::KnownType::Enum Native = Generated::KnownType::Enum::i32;
        uint16_t TypeIdx = UINT16_MAX;
    };

    struct Type
    {
        int32_t FieldCount = 0;
        FieldType FieldTypes[MaxFields];
        char FieldNames[MaxFields][MaxNameLength];
        uint32_t FieldArraySizes[MaxFields]{0};
        char FieldValues[MaxFields][128]{0};
        char Name[MaxNameLength]{0};
        uint32_t Hash = 0;
    };

    struct Enum
    {
        FieldType EnumType;
        int32_t EntryCount = 0;
        char EntryNames[MaxFields][MaxNameLength];
        int32_t ExtraStringFieldCount = 0;
        char ExtraStringFieldNames[MaxExtraEnumFields][MaxNameLength];
        char ExtraStringFields[MaxFields][MaxExtraEnumFields][MaxNameLength];
        char Name[MaxNameLength]{0};
        uint32_t Hash = 0;
    };

    struct DefinitionFile
    {
        static constexpr int32_t MaxTypes = 256;
        Def::Type Types[MaxTypes];
        uint16_t TypeCount = 0;
        Def::Enum Enums[MaxTypes];
        int32_t EnumCount = 0;
    };
} // namespace Def
