//
// Created by Dan Crosby on 3/14/21.
//

#include "CommandFactoriesList.hpp"

#include "src/main/cpp/net/eagle0/shardok/library/command_factories/BraveWaterCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/BuildBridgeCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/ChallengeDuelCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/ChargeCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/ControlCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/ExtinguishFireCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/FearCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/FleeCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/FortifyCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/FreezeWaterCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/HideCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/HolyWaveCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/LightningBoltCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/MeteorStartCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/MeteorTargetCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/MoveCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/RaiseDeadCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/ReduceCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/ReinforceCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/RepairCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/RetreatCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/ScoutCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/StartFireCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/archery_command_factory/ArcheryCommandFactory.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/command_factories/melee_command_factory/MeleeCommandFactory.hpp"

namespace shardok {

using std::make_shared;

auto MakeFactories(const SettingsGetter& settings) -> vector<shared_ptr<const CommandFactory>> {
    // Command factories that produce "must-do" commands like Meteor Target should be first.
    // Ultimately I should probably move that metadata into the CommandFactory and sort it here.

    return {make_shared<MeteorTargetCommandFactory>(settings),
            make_shared<ControlCommandFactory>(settings),
            make_shared<ArcheryCommandFactory>(settings),
            make_shared<BraveWaterCommandFactory>(settings),
            make_shared<BuildBridgeCommandFactory>(settings),
            make_shared<ChallengeDuelCommandFactory>(settings),
            make_shared<ChargeCommandFactory>(settings),
            make_shared<ExtinguishFireCommandFactory>(settings),
            make_shared<FearCommandFactory>(settings),
            make_shared<FleeCommandFactory>(settings),
            make_shared<FortifyCommandFactory>(settings),
            make_shared<FreezeWaterCommandFactory>(settings),
            make_shared<HideCommandFactory>(settings),
            make_shared<HolyWaveCommandFactory>(settings),
            make_shared<LightningBoltCommandFactory>(settings),
            make_shared<MeleeCommandFactory>(settings),
            make_shared<MeteorStartCommandFactory>(settings),
            make_shared<RaiseDeadCommandFactory>(settings),
            make_shared<ReduceCommandFactory>(settings),
            make_shared<ReinforceCommandFactory>(settings),
            make_shared<RepairCommandFactory>(settings),
            make_shared<RetreatCommandFactory>(settings),
            make_shared<ScoutCommandFactory>(settings),
            make_shared<StartFireCommandFactory>(settings),
            make_shared<MoveCommandFactory>(settings)};
}

auto CommandFactoriesList::GetFactories() const -> vector<shared_ptr<const CommandFactory>> {
    return factories;
}

CommandFactoriesList::CommandFactoriesList(const SettingsGetter& settings)
    : factories(MakeFactories(settings)) {}
}  // namespace shardok
