#pragma once

#include "../WorldGenerationFunctions/IWorldGenerationFunction.h"
#include "../PlanetaryCore.h"
#include "warfactory/ResourceRegistry.h"
#include <map>
#include <string>

namespace warfactory {

/**
 * @brief Initialize planetary core with base composition and capacity
 *
 * Sets up the planetary core with initial temperature, maximum capacity,
 * and base rock/iron composition for the geological simulation.
 */
class InitializePlanetaryCoreFunction : public IWorldGenerationFunction {
private:
    float core_temperature_celsius;
    __uint128_t max_core_capacity;
    std::map<uint32_t, __uint128_t> base_composition;  // Resource ID -> quantity

public:
    InitializePlanetaryCoreFunction();

    // Inherited from IWorldGenerationFunction
    void configure(const IDataNode& config) override;
    void execute(WorldData& world, PlanetaryCore& core) override;
    std::string getStepName() const override;
    bool isConfigured() const override;
    void reset() override;

private:
    /**
     * @brief Parse resource names from config and convert to IDs
     */
    void parseResourceConfiguration(const IDataNode& config);

    /**
     * @brief Apply base composition to planetary core
     */
    void applyBaseComposition(PlanetaryCore& core);
};

} // namespace warfactory