import Asteroid from '../../../types/Asteroid';
import SystemManager from './SystemManager';
import { updateSystemAsteroids } from '../../db/systems';

export default class AsteroidManager {
    asteroids: Array<Asteroid> = [];
    system: SystemManager;

    constructor(system: SystemManager) {
        this.system = system;
    }

    init(asteroids: Array<Asteroid>) {
        this.asteroids = asteroids;
    }

    async sync() {
        await updateSystemAsteroids(this.system.data._id, this.asteroids);
    }
}