import EnergyManager from "./abstract/EnergyManager";
import SystemManager from "./SystemManager";

export default class SystemEnergyManager extends EnergyManager {
    constructor(system: SystemManager) {
        super(system);
    }

    get manager() {
        return this._manager as SystemManager;
    }

    update() {
        const structures = this.manager.structures.structures;

        for(const structure of structures) {
            if(structure.data.id === "dyson-sphere") {
                this.production += (structure.data.energy * structure.level);
            } else {
                this.consumption += (structure.data.energy * structure.level);
            }
        }

        return this;
    }
}