import { updateSystemShips } from "../../db/systems";
import SystemManager from "./SystemManager";
import ShipManager from "./abstract/ShipManager";

export default class SystemShipManager extends ShipManager {
    constructor(system: SystemManager) {
        super(system);
    }

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

    async sync() {
        await updateSystemShips(this.manager.data._id, this.ships.map(ship => { return { id: ship.data.id, amount: ship.amount } }));
    }
}