// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.

using System.Text.Json.Serialization;
using Wonderking.Game.Data.Item;
using Wonderking.Utils;

namespace Wonderking.Game.Data;

[GameDataMetadata(932, "baseitemdata.dat", 197)]
public struct ItemObject
{
    public uint ItemID { get; set; }
    public bool Disabled { get; set; }
    public uint ItemType { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown2 { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown3 { get; set; }

    public uint ClassNo1 { get; set; }
    public uint ClassNo2 { get; set; }
    public uint ClassNo3 { get; set; }
    public uint ClassNo4 { get; set; }
    public uint SlotNo1 { get; set; }
    public uint SlotNo2 { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown4 { get; set; }

    public uint IsCash { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown5 { get; set; }

    public uint Price { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown7 { get; set; }

    public uint MaxNumber { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown17 { get; set; }

    public uint MaximumLevelRequirement { get; set; }
    public uint SexNo { get; set; }
    public uint WeaponSomething { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown8 { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R2C { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown9 { get; set; }

    public Stats Stats { get; set; }
    public ElementalStats ElementalStats { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R7C { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R8C { get; set; }

    public float Speed { get; set; }

    public float Jump { get; set; }
    public int StatDefense { get; set; }
    public uint MagicID { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown13 { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown14 { get; set; }

    public int AdditionalHealthRecoveryVolume { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R9C_1 { get; set; }

    public int AdditionalManaRecoveryVolume { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R9C_2 { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R10C { get; set; }

    public int AdditionalHealthPoints { get; set; }
    public int AdditionalManaPoints { get; set; }
    public bool IsArrow { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown18 { get; set; }

    public int AdditionalEvasionRate { get; set; }
    public int HitRate { get; set; }

    public int ChanceToHit { get; set; }
    public int MagicalDamage { get; set; }
    public int CriticalHitChance { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R12C { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown16 { get; set; }

    public int MinimalAttackDamage { get; set; }
    public int MaximalAttackDamage { get; set; }
    public int PhysicalDamage { get; set; }
    public CraftMaterial[] CraftMaterial { get; set; }
    public uint CraftResultAmount { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R14C { get; set; }

    public uint CraftResultItem { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R15C { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] R16C { get; set; }

    public int InventoryX { get; set; }
    public int InventoryY { get; set; }
    public int InventoryWidth { get; set; }
    public int InventoryHeight { get; set; }
    public int SheetID { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown1 { get; set; }

    public bool IsEnchantable { get; set; }

    public uint SetID { get; set; }
    public uint[] SetItems { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown1_2 { get; set; }

    public ItemOptions Options { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown19 { get; set; }

    public byte PetID { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown20 { get; set; }

    public byte HitBoxScaling { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown20_2 { get; set; }

    public ContainedItem[] ContainedItems { get; set; }

    public bool IsQuestItem { get; set; }
    public byte MinimumLevelRequirement { get; set; }

    [JsonConverter(typeof(ByteArrayConverter))]
    public byte[] Unknown21_2 { get; set; }
}