|
|
@@ -0,0 +1,51 @@
|
|
|
+import { type_manager } from "./functions.js";
|
|
|
+import { element } from "./element.js";
|
|
|
+import { elements_list } from "./elements_list.js";
|
|
|
+
|
|
|
+class submission {
|
|
|
+ #title;
|
|
|
+ #description;
|
|
|
+ #picture;
|
|
|
+ #elements;
|
|
|
+
|
|
|
+ constructor(title, description, picture, elements) {
|
|
|
+ if (!type_manager.is_string(title)) {
|
|
|
+ throw "Title must be an string.";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!type_manager.is_string(description)) {
|
|
|
+ throw "Description must be an string.";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!type_manager.is_string(picture)) {
|
|
|
+ throw "Picture must be URL.";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!(elements instanceof elements_list)) {
|
|
|
+ throw "Elements list must be instance of elements_list.";
|
|
|
+ }
|
|
|
+
|
|
|
+ this.#title = title;
|
|
|
+ this.#description = description;
|
|
|
+ this.#picture = picture;
|
|
|
+ this.#elements = elements;
|
|
|
+ }
|
|
|
+
|
|
|
+ get title() {
|
|
|
+ return this.#title;
|
|
|
+ }
|
|
|
+
|
|
|
+ get description() {
|
|
|
+ return this.#description;
|
|
|
+ }
|
|
|
+
|
|
|
+ get picture() {
|
|
|
+ return this.#picture;
|
|
|
+ }
|
|
|
+
|
|
|
+ get elements() {
|
|
|
+ return Array.from(this.#elements);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export { submission };
|