#include "TestLibrary.hpp"
#include <Arbutils/StringView.hpp>

PkmnLib::Battling::BattleLibrary* TestLibrary::_library = nullptr;
PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
    auto lib = new PkmnLib::Library::SpeciesLibrary();
    lib->Insert("testSpecies"_cnc.GetHash(),
                new PkmnLib::Library::PokemonSpecies(
                    1, "testSpecies"_cnc,
                    new PkmnLib::Library::PokemonForme(
                        "default"_cnc, 1.0f, 1.0f, 236, {0},
                        CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
                        {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
                    0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
    lib->Insert("testSpecies2"_cnc.GetHash(),
                new PkmnLib::Library::PokemonSpecies(
                    2, "testSpecies2"_cnc,
                    new PkmnLib::Library::PokemonForme(
                        "default"_cnc, 1.0f, 1.0f, 306, {0},
                        CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
                        {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
                    0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
    lib->Insert("statTestSpecies1"_cnc.GetHash(),
                new PkmnLib::Library::PokemonSpecies(
                    3, "statTestSpecies1"_cnc,
                    new PkmnLib::Library::PokemonForme(
                        "default"_cnc, 1.0f, 1.0f, 236, {0},
                        CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
                        {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
                    0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
    lib->Insert("testSpecies3"_cnc.GetHash(),
                new PkmnLib::Library::PokemonSpecies(
                    4, "testSpecies3"_cnc,
                    new PkmnLib::Library::PokemonForme(
                        "default"_cnc, 1.0f, 1.0f, 236, {0, 4},
                        CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
                        {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
                    0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));

    lib->Insert("testCharizard"_cnc.GetHash(),
                new PkmnLib::Library::PokemonSpecies(
                    5, "testCharizard"_cnc,
                    new PkmnLib::Library::PokemonForme(
                        "default"_cnc, 1.7f, 90.5f, 240, {0, 4},
                        CreatureLib::Library::StatisticSet<uint16_t>(78, 84, 78, 109, 85, 100), {"testAbility"_cnc},
                        {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
                    0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
    lib->Insert("testVenusaur"_cnc.GetHash(),
                new PkmnLib::Library::PokemonSpecies(
                    6, "testVenusaur"_cnc,
                    new PkmnLib::Library::PokemonForme(
                        "default"_cnc, 2.0f, 100.0f, 236, {0, 4},
                        CreatureLib::Library::StatisticSet<uint16_t>(80, 82, 83, 100, 100, 80), {"testAbility"_cnc},
                        {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
                    0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));

    return lib;
}
PkmnLib::Library::MoveLibrary* TestLibrary::BuildMoveLibrary() {
    auto lib = new PkmnLib::Library::MoveLibrary();
    lib->Insert("testMove"_cnc.GetHash(),
                new PkmnLib::Library::MoveData("testMove"_cnc, 0, PkmnLib::Library::MoveCategory::Physical, 50, 100, 20,
                                               CreatureLib::Library::AttackTarget::Adjacent, 0,
                                               new CreatureLib::Library::SecondaryEffect(), {}));
    lib->Insert("testMove2"_cnc.GetHash(),
                new PkmnLib::Library::MoveData("testMove2"_cnc, 0, PkmnLib::Library::MoveCategory::Special, 30, 100, 10,
                                               CreatureLib::Library::AttackTarget::Adjacent, 0,
                                               new CreatureLib::Library::SecondaryEffect(), {}));
    return lib;
}
PkmnLib::Library::ItemLibrary* TestLibrary::BuildItemLibrary() {
    auto lib = new PkmnLib::Library::ItemLibrary();
    lib->Insert("testItem"_cnc.GetHash(),
                new PkmnLib::Library::Item("testItem"_cnc, CreatureLib::Library::ItemCategory::MiscItem,
                                           CreatureLib::Library::BattleItemCategory::None, 0, nullptr, {}, 0));
    return lib;
}