import { updateSystemDefenses } from "../../db/systems";
import SystemManager from "./SystemManager";
import DefenseManager from "./abstract/DefenseManager";

export default class SystemDefenseManager extends DefenseManager {
    constructor(system: SystemManager) {
        super(system);
    }

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

    async sync() {
        await updateSystemDefenses(this.manager.data._id, this.defenses.map(def => { return { id: def.data.id, amount: def.amount } }));
    }
}