#pragma once

#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>

#include "features/items/contracts/ItemCatalogTypes.h"

struct Il2CppObject;

namespace ta::adapters::eft::items
{
    struct ItemTemplateRecord
    {
        std::string id;
        std::string type_name;
        ta::features::items::contracts::ItemCategory category =
            ta::features::items::contracts::ItemCategory::Other;
        int max_stack_size = 1;
    };

    class ItemTemplateReader final
    {
    public:
        bool begin(Il2CppObject* factory);
        void reset() noexcept;

        [[nodiscard]] std::size_t count() const noexcept;
        [[nodiscard]] std::optional<ItemTemplateRecord> read(std::size_t index) const;

    private:
        Il2CppObject* templates_object_ = nullptr;
        std::size_t count_ = 0;
    };
}
