@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
175 lines (169 loc) • 4.18 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
import {Project} from './Project';
import {Sensor} from './Sensor';
import {VirtualGroup} from './VirtualGroup';
import {VirtualExpression} from './VirtualExpression';
declare var Object: any;
export interface VirtualVariableInterface {
type?: string;
name: string;
description?: string;
value?: number;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
projectId?: any;
sensorId?: any;
virtualGroupId?: any;
trackingLogs?: Log[];
project?: Project;
sensor?: Sensor;
virtualGroup?: VirtualGroup;
virtualExpressions?: VirtualExpression[];
}
export class VirtualVariable implements VirtualVariableInterface {
type: string = 'null';
name: string;
description: string;
value: number;
created: Date;
modified: Date;
deleted: Date;
id: any;
projectId: any;
sensorId: any;
virtualGroupId: any;
trackingLogs?: Log[];
project?: Project;
sensor?: Sensor;
virtualGroup?: VirtualGroup;
virtualExpressions?: VirtualExpression[];
constructor(data?: VirtualVariableInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `VirtualVariable`.
*/
public static getModelName(): string {
return 'VirtualVariable';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of VirtualVariable for dynamic purposes.
*/
public static factory(data: VirtualVariableInterface): VirtualVariable{
return new VirtualVariable(data);
}
/**
* @method getModelDefinition
* @author Julien Ledun
* @license MIT
* This method returns an object that represents some of the model
* definitions.
*/
public static getModelDefinition(): ModelDefinition {
return {
name: 'VirtualVariable',
plural: 'VirtualVariables',
path: 'VirtualVariables',
idName: 'id',
properties: {
type: {
name: 'type',
type: 'string',
default: 'null'
},
name: {
name: 'name',
type: 'string'
},
description: {
name: 'description',
type: 'string'
},
value: {
name: 'value',
type: 'number'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
id: {
name: 'id',
type: 'any'
},
projectId: {
name: 'projectId',
type: 'any'
},
sensorId: {
name: 'sensorId',
type: 'any'
},
virtualGroupId: {
name: 'virtualGroupId',
type: 'any'
},
},
relations: {
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
project: {
name: 'project',
type: 'Project',
model: 'Project',
relationType: 'belongsTo',
keyFrom: 'projectId',
keyTo: 'id'
},
sensor: {
name: 'sensor',
type: 'Sensor',
model: 'Sensor',
relationType: 'belongsTo',
keyFrom: 'sensorId',
keyTo: 'id'
},
virtualGroup: {
name: 'virtualGroup',
type: 'VirtualGroup',
model: 'VirtualGroup',
relationType: 'belongsTo',
keyFrom: 'virtualGroupId',
keyTo: 'id'
},
virtualExpressions: {
name: 'virtualExpressions',
type: 'VirtualExpression[]',
model: 'VirtualExpression',
relationType: 'hasMany',
modelThrough: 'VirtualVariableVirtualExpression',
keyThrough: 'virtualExpressionId',
keyFrom: 'id',
keyTo: 'virtualVariableId'
},
}
};
}
}