#pragma once

#include "warfactory/IRegion.h"
#include <vector>
#include <memory>
#include <string>

namespace warfactory {

class RegionManager {
private:
    std::vector<std::unique_ptr<IRegion>> regions;
    int next_region_id;

public:
    RegionManager();

    int createRegion(const std::string& region_type, float x, float y, float mass, float radius);

    void addRegion(std::unique_ptr<IRegion> region);

    void removeRegion(int region_id);

    IRegion* getRegion(int region_id);
    const IRegion* getRegion(int region_id) const;

    std::vector<IRegion*> getRegionsInRadius(float center_x, float center_y, float radius);

    std::vector<IRegion*> getRegionsByType(const std::string& region_type);

    void updateAllRegions(float delta_time);

    void processFusions();

    size_t getRegionCount() const { return regions.size(); }

    void clear();
};

} // namespace warfactory