import { ObjectId } from "mongodb";
import ResearchManager from "./managers/ResearchManager";
import { Planet } from "./managers/PlanetManager";

export default class User {
    id: ObjectId;
    username: string;
    email: string;
    createdAt: Date;
    updatedAt: Date;
    lastLogin: Date;
    research: ResearchManager;
    mainPlanet!: Planet;
    
    constructor(id: ObjectId, username: string, email: string, createdAt: Date, updatedAt: Date, lastLogin: Date) {
        this.id = id;
        this.username = username;
        this.email = email;
        this.createdAt = createdAt;
        this.updatedAt = updatedAt;
        this.lastLogin = lastLogin;
        this.research = new ResearchManager(this);
    }

    async init() {
        await this.research.init();
    }

    addMainPlanet(planet: Planet) {
        this.mainPlanet = planet;
    }
}