submission.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { type_manager } from "./functions.js";
  2. import { element } from "./element.js";
  3. import { elements_list } from "./elements_list.js";
  4. class submission {
  5. #title;
  6. #description;
  7. #picture;
  8. #elements;
  9. constructor(title, description, picture, elements) {
  10. if (!type_manager.is_string(title)) {
  11. throw "Title must be an string.";
  12. }
  13. if (!type_manager.is_string(description)) {
  14. throw "Description must be an string.";
  15. }
  16. if (!type_manager.is_string(picture)) {
  17. throw "Picture must be URL.";
  18. }
  19. if (!(elements instanceof elements_list)) {
  20. throw "Elements list must be instance of elements_list.";
  21. }
  22. this.#title = title;
  23. this.#description = description;
  24. this.#picture = picture;
  25. this.#elements = elements;
  26. }
  27. get title() {
  28. return this.#title;
  29. }
  30. get description() {
  31. return this.#description;
  32. }
  33. get picture() {
  34. return this.#picture;
  35. }
  36. get elements() {
  37. return this.#elements;
  38. }
  39. }
  40. export { submission };