import { submission } from "./submission.js"; class project { #name; #description; #submissions; constructor(name) { this.#name = name; this.#description = ""; this.clean(); } get name() { return this.#name; } get description() { return this.#description; } set description(content) { if (typeof(content) !== "string") { throw "Description must be an string."; } this.#description = content; } get names() { return Object.keys(this.#submissions); } get submissions() { return Object.values(this.#submissions); } get first_submission() { if (this.submissions.length < 1) { throw "In project must be minimum one submission to get first."; } return this.submissions[0]; } get(name) { if (typeof(name) !== "string") { throw "Name of submission must be an string."; } return this.#submissions[name]; } add(content) { if (!(content instanceof submission)) { throw "New submission must be instance of submission class."; } if (content.name in this.#submissions) { throw "Trying to add submission which already exists."; } this.#submissions[content.name] = content; } clean() { this.#submissions = {}; } } export { project };