#pragma once

#include <cstdint>

#include "application/config/ConfigOwner.h"
#include "application/config/values/BasicValues.h"
#include "application/config/values/KeybindValue.h"
#include "application/config/values/NumberValues.h"
#include "application/config/values/TextValues.h"
#include "features/player/IPlayerSettings.h"

namespace ta::adapters::config
{
    class PlayerConfigAdapter final : public ta::application::config::ConfigOwner,
                                        public ta::features::player::IPlayerSettings
    {
    public:
        PlayerConfigAdapter();
        [[nodiscard]] ta::features::player::PlayerSettings read() const override;
        void set_speed_hack(bool enabled) override;
        void set_fly_mode(bool enabled) override;

        [[nodiscard]] ta::features::player::PlayerCommand make_add_exp_command(std::uint64_t trace_id) const;
        [[nodiscard]] ta::features::player::PlayerCommand make_add_fence_rep_command(std::uint64_t trace_id) const;
        [[nodiscard]] ta::features::player::PlayerCommand make_add_trader_rep_command(std::uint64_t trace_id) const;
        [[nodiscard]] ta::features::player::PlayerCommand make_set_skill_command(std::uint64_t trace_id) const;

    private:
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> god_mode_{*this, "god_mode", false, "God Mode"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> infinite_stamina_{*this, "infinite_stamina", false, "Infinite Stamina"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> no_hunger_thirst_{*this, "no_hunger_thirst", false, "No Hunger/Thirst"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> instant_search_{*this, "instant_search", false, "Instant Search"};
        ta::application::config::RegisteredConfigValue<ta::application::config::SelectValue> exp_type_{*this, "exp_type", 0, std::initializer_list<const char*>{
            "ExpDoorBreached", "ExpItemLooting", "ExpDamage", "ExpHeal", "ExpExamine", "ExpKillBase"}, "Exp Type"};
        ta::application::config::RegisteredConfigValue<ta::application::config::IntSliderValue> exp_amount_{*this, "exp_amount", 10000, 0, 500000, "Exp Amount"};
        ta::application::config::RegisteredUiAction add_exp_{*this, "add_exp", "Add Exp"};
        ta::application::config::RegisteredConfigValue<ta::application::config::SelectValue> fence_rep_source_{*this, "fence_rep_source", 0, std::initializer_list<const char*>{
            "Boss Help", "Scav Help", "Scav Kill", "Boss Kill", "Traitor Kill", "Exit Standing"}, "Fence Rep Source"};
        ta::application::config::RegisteredConfigValue<ta::application::config::FloatSliderValue> fence_rep_amount_{*this, "fence_rep_amount", 0.1f, 0.f, 5.f, "Fence Rep Amount", 0.01f};
        ta::application::config::RegisteredUiAction add_fence_rep_{*this, "add_fence_rep", "Add Fence Rep"};
        ta::application::config::RegisteredConfigValue<ta::application::config::SelectValue> trader_select_{*this, "trader_select", 0, std::initializer_list<const char*>{
            "Lightkeeper", "Ragman", "Ref", "Peacekeeper", "Skier", "Prapor", "Jaeger", "Mechanic", "Therapist", "BTR"}, "Trader"};
        ta::application::config::RegisteredConfigValue<ta::application::config::FloatSliderValue> trader_rep_amount_{*this, "trader_rep_amount", 0.1f, 0.f, 5.f, "Trader Rep Amount", 0.01f};
        ta::application::config::RegisteredUiAction add_trader_rep_{*this, "add_trader_rep", "Add Trader Rep"};
        ta::application::config::RegisteredConfigValue<ta::application::config::SelectValue> skill_select_{*this, "skill_select", 0, std::initializer_list<const char*>{
            "Pistol", "Revolver", "SMG", "Assault", "Shotgun", "Sniper", "LMG", "HMG", "Launcher", "AttachedLauncher",
            "Misc", "Melee", "DMR", "Throwing", "AimDrills", "RecoilControl", "TroubleShooting", "Perception", "Attention",
            "Intellect", "Immunity", "Charisma", "Memory", "Endurance", "Strength", "Vitality", "Health", "Metabolism",
            "StressResistance", "Sniping", "CovertMovement", "ProneMovement", "LightVests", "HeavyVests", "WeaponModding",
            "AdvancedModding", "Lockpicking", "Surgery", "Search", "WeaponTreatment", "MagDrills", "Freetrading", "Barter",
            "Crafting", "HideoutManagement", "BearAssaultoperations", "BearAuthority", "BearAksystems", "BearHeavycaliber",
            "BearRawpower", "UsecArsystems", "UsecDeepweaponmodding", "UsecLongrangeoptics", "UsecNegotiations", "UsecTactics"}, "Skill"};
        ta::application::config::RegisteredConfigValue<ta::application::config::IntSliderValue> skill_level_{*this, "skill_level", 51, 0, 51, "Skill Level"};
        ta::application::config::RegisteredUiAction set_skill_{*this, "set_skill", "Set Skill"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> speed_hack_{*this, "speed_hack", false, "Speed Hack"};
        ta::application::config::RegisteredConfigValue<ta::application::config::KeybindValue> speed_hotkey_{*this, "speed_hotkey", 0, "Hotkey"};
        ta::application::config::RegisteredConfigValue<ta::application::config::IntSliderValue> speed_{*this, "speed", 2, 1, 20, "Speed"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> fly_mode_{*this, "fly_mode", false, "Fly Mode"};
        ta::application::config::RegisteredConfigValue<ta::application::config::KeybindValue> fly_hotkey_{*this, "fly_hotkey", 0, "Hotkey"};
        ta::application::config::RegisteredConfigValue<ta::application::config::KeybindValue> up_{*this, "up", 0x20, "Up"};
        ta::application::config::RegisteredConfigValue<ta::application::config::KeybindValue> down_{*this, "down", 0x11, "Down"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> always_survive_{*this, "always_survive", false, "Always Survive"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> no_malfunction_{*this, "no_malfunction", false, "No Malfunction"};
        ta::application::config::RegisteredConfigValue<ta::application::config::CheckboxValue> infinite_ammo_{*this, "infinite_ammo", false, "Infinite Ammo"};
    };
}
