Initial commit

This commit is contained in:
root
2025-12-21 09:59:17 -05:00
committed by Sebastian Krupinski
commit 974d3fe11b
53 changed files with 7555 additions and 0 deletions
+158
View File
@@ -0,0 +1,158 @@
/**
* Class model for Collection Interface
*/
import type {
CollectionInterface,
CollectionContentsInterface,
CollectionPermissionsInterface,
} from "@/types/collection";
export class CollectionObject implements CollectionInterface {
_data!: CollectionInterface;
constructor() {
this._data = {
'@type': 'chrono:collection',
provider: null,
service: null,
in: null,
id: null,
label: null,
description: null,
priority: null,
visibility: null,
color: null,
enabled: true,
signature: null,
permissions: {},
contents: {},
};
}
fromJson(data: CollectionInterface): CollectionObject {
this._data = data;
return this;
}
toJson(): CollectionInterface {
return this._data;
}
clone(): CollectionObject {
const cloned = new CollectionObject();
cloned._data = JSON.parse(JSON.stringify(this._data));
return cloned;
}
/** Properties */
get '@type'(): string {
return this._data['@type'];
}
get provider(): string | null {
return this._data.provider;
}
set provider(value: string | null) {
this._data.provider = value;
}
get service(): string | null {
return this._data.service;
}
set service(value: string | null) {
this._data.service = value;
}
get in(): number | string | null {
return this._data.in;
}
set in(value: number | string | null) {
this._data.in = value;
}
get id(): number | string | null {
return this._data.id;
}
set id(value: number | string | null) {
this._data.id = value;
}
get label(): string | null {
return this._data.label;
}
set label(value: string | null) {
this._data.label = value;
}
get description(): string | null {
return this._data.description;
}
set description(value: string | null) {
this._data.description = value;
}
get priority(): number | null {
return this._data.priority;
}
set priority(value: number | null) {
this._data.priority = value;
}
get visibility(): string | null {
return this._data.visibility;
}
set visibility(value: string | null) {
this._data.visibility = value;
}
get color(): string | null {
return this._data.color;
}
set color(value: string | null) {
this._data.color = value;
}
get enabled(): boolean {
return this._data.enabled;
}
set enabled(value: boolean) {
this._data.enabled = value;
}
get signature(): string | null {
return this._data.signature;
}
set signature(value: string | null) {
this._data.signature = value;
}
get permissions(): CollectionPermissionsInterface {
return this._data.permissions;
}
set permissions(value: CollectionPermissionsInterface) {
this._data.permissions = value;
}
get contents(): CollectionContentsInterface {
return this._data.contents;
}
set contents(value: CollectionContentsInterface) {
this._data.contents = value;
}
}