// tslint:disable: max-classes-per-file import { BaseModel } from '@verb/src/libs/shared/base/base.model'; export class VideoUploadModel implements BaseModel { public owner = new VideoUploadOwnerModel(); public constructor(videoUploadData?: VideoUploadData) { if (videoUploadData) { this.fromSchema(videoUploadData); } } public get statusUrl() { return this._statusUrl; } public get uploadMethod() { return this._uploadMethod; } public set uploadMethod(_uploadMethod) { this._uploadMethod = _uploadMethod; } public get uploadUrl() { return this._uploadUrl; } public set uploadUrl(_uploadUrl) { this._uploadUrl = _uploadUrl; } public get statusId() { return this._statusId; } public set statusId(_statusId) { this._statusId = _statusId; this._statusUrl = `/video/status/${_statusId}`; } public setOwner(clientId: string, userId: string) { this.owner.clientId = clientId; this.owner.userId = userId; } public fromSchema(videoUploadData: VideoUploadData) { this._statusUrl = videoUploadData.status_url; this._uploadMethod = videoUploadData.upload_method; this._uploadUrl = videoUploadData.upload_url; this._statusId = videoUploadData.status_id; if (videoUploadData.owner) { this.owner.clientId = videoUploadData.owner.client_id; this.owner.userId = videoUploadData.owner.user_id; } } public toSchema(): VideoUploadData { return { owner: this.owner.toSchema(), status_id: this._statusId, status_url: this._statusUrl, upload_method: this._uploadMethod, upload_url: this._uploadUrl, }; } private _statusUrl = '/video/status/'; private _uploadMethod = ''; private _uploadUrl = ''; private _statusId = ''; } export interface VideoUploadData { owner: VideoUploadOwnerData; status_id: string; status_url: string; upload_method: string; upload_url: string; } export class VideoUploadOwnerModel implements BaseModel { public clientId = ''; public userId = ''; public toSchema(): VideoUploadOwnerData { return { client_id: this.clientId, user_id: this.userId, }; } } export interface VideoUploadOwnerData { client_id: string; user_id: string; }