#pragma once

#include "Meteorite.h"
#include "WorldData.h"
#include "PlanetaryCore.h"

namespace warfactory {

class SurfaceState;

class MeteoriteImpact {
private:
    Meteorite meteorite_template;
    float impact_size;
    float impact_velocity;
    float impact_angle;
    float x_position, y_position;

public:
    MeteoriteImpact(const Meteorite& meteorite, float size, float velocity, float angle, float x, float y);

    void applyImpactEffects(WorldData& world, PlanetaryCore& core);

    void createCrater(WorldData& world);

    void depositMaterials(PlanetaryCore& core, SurfaceState& surface, RegionManager& region_manager);

    void generateHeat(WorldData& world);

    float calculateKineticEnergy() const;
    float calculateImpactRadius() const;
    float calculateHeatGeneration() const;
    float calculateCraterDepth() const;
    float calculateCraterRadius() const;

    const Meteorite& getMeteoriteTemplate() const { return meteorite_template; }
    float getImpactSize() const { return impact_size; }
    float getImpactVelocity() const { return impact_velocity; }
    float getImpactAngle() const { return impact_angle; }
    float getX() const { return x_position; }
    float getY() const { return y_position; }
};

} // namespace warfactory