import { updatePlanetShips } from "../../db/planets";
import { Planet } from "./PlanetManager";
import ShipManager from "./abstract/ShipManager";

export default class PlanetShipManager extends ShipManager {
    constructor(planet: Planet) {
        super(planet);
    }

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

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