#pragma once

#include <string>
#include <unordered_map>
#include <nlohmann/json.hpp>

using json = nlohmann::json;

namespace warfactory {

class Meteorite {
private:
    std::string meteorite_type;
    std::unordered_map<std::string, float> resource_composition;
    float impact_energy_multiplier;
    float crater_formation_factor;
    float surface_metal_deposit_ratio;

public:
    Meteorite() = default;
    Meteorite(const json& meteorite_data);

    const std::string& getMeteoriteType() const { return meteorite_type; }

    const std::unordered_map<std::string, float>& getResourceComposition() const { return resource_composition; }
    float getResourceQuantity(const std::string& resource_id) const;
    bool hasResource(const std::string& resource_id) const;

    float getImpactEnergyMultiplier() const { return impact_energy_multiplier; }
    float getCraterFormationFactor() const { return crater_formation_factor; }
    float getSurfaceMetalDepositRatio() const { return surface_metal_deposit_ratio; }

    static Meteorite loadFromJson(const std::string& meteorite_type, const json& meteorite_data);
};

} // namespace warfactory