#include "../../src/Library/Evolutions/EvolutionData.hpp"
#include "../Core.hpp"
using namespace PkmnLib::Library;

export_func const EvolutionData* PkmnLib_EvolutionData_CreateLevelEvolution(uint8_t level, const PokemonSpecies* into) {
    return EvolutionData::CreateLevelEvolution(level, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution(uint8_t friendship,
                                                                            const PokemonSpecies* into) {
    return EvolutionData::CreateFriendshipEvolution(friendship, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime,
                                                                                TimeOfDay endTime,
                                                                                const PokemonSpecies* into) {
    return EvolutionData::CreateFriendshipTimeEvolution(friendship, startTime, endTime, into);
}

export_func const EvolutionData* PkmnLib_EvolutionData_CreateKnownMoveEvolution(const MoveData* move,
                                                                           const PokemonSpecies* into) {
    return EvolutionData::CreateKnownMoveEvolution(move, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateLocationEvolution(const char* location,
                                                                          const PokemonSpecies* into) {
    return EvolutionData::CreateLocationEvolution(ArbUt::StringView(location), into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime,
                                                                      const PokemonSpecies* into) {
    return EvolutionData::CreateTimeEvolution(startTime, endTime, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemEvolution(const Item* item,
                                                                          const PokemonSpecies* into) {
    return EvolutionData::CreateHeldItemEvolution(item, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime,
                                                                              TimeOfDay endTime,
                                                                              const PokemonSpecies* into) {
    return EvolutionData::CreateHeldItemTimeEvolution(item, startTime, endTime, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateGenderBasedEvolution(CreatureLib::Library::Gender gender,
                                                                             uint8_t level,
                                                                             const PokemonSpecies* into) {
    return EvolutionData::CreateGenderBasedEvolution(gender, level, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) {
    return EvolutionData::CreateItemUseEvolution(item, into);
}

export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item,
                                                                                   CreatureLib::Library::Gender gender,
                                                                                   const PokemonSpecies* into) {
    return EvolutionData::CreateItemUseWithGenderEvolution(item, gender, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeEvolution(const PokemonSpecies* into) {
    return EvolutionData::CreateTradeEvolution(into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithItemEvolution(const Item* item,
                                                                               const PokemonSpecies* into) {
    return EvolutionData::CreateTradeWithItemEvolution(item, into);
}
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded,
                                                                                  const PokemonSpecies* into) {
    return EvolutionData::CreateTradeWithSpeciesEvolution(traded, into);
}
export_func const EvolutionData*
PkmnLib_EvolutionData_CreateCustomEvolution(const CreatureLib::Library::EffectParameter** data, size_t dataLength,
                                            const PokemonSpecies* into) {
    auto list = std::vector<const CreatureLib::Library::EffectParameter*>(data, data + dataLength);
    return EvolutionData::CreateCustomEvolution(list, into);
}

export_func EvolutionMethod PkmnLib_EvolutionData_GetMethod(const EvolutionData* data) { return data->GetMethod(); }
export_func const PokemonSpecies* PkmnLib_EvolutionData_GetNewSpecies(const EvolutionData* data) {
    return data->GetNewSpecies().GetRaw();
}
export_func size_t PkmnLib_EvolutionData_GetDataCount(const EvolutionData* data) { return data->GetDataCount(); }
export_func uint8_t PkmnLib_EvolutionData_GetDataAt(const EvolutionData* data, size_t index,
                                               const CreatureLib::Library::EffectParameter*& out) {
    Try(out = data->GetDataAt(index).GetRaw());
}