@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
262 lines (256 loc) • 5.74 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Asset} from './Asset';
import {AssetState} from './AssetState';
import {Log} from './Log';
import {Sensor} from './Sensor';
import {SensorAssetState} from './SensorAssetState';
declare var Object: any;
export interface AlertNotificationInterface {
type?: string;
subjectType?: string;
name?: string;
thresholdType?: string;
from?: Date;
to?: Date;
opened?: Date;
closed?: Date;
length?: number;
summary?: any;
threshold?: any;
notification?: any;
projectInfo?: any;
assetInfo?: any;
sensorInfo?: any;
sendAt?: Date;
admins?: Array<any>;
managers?: Array<any>;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
assetId?: any;
assetStateId?: any;
sensorId?: any;
stateId?: any;
asset?: Asset;
assetState?: AssetState;
trackingLogs?: Log[];
sensor?: Sensor;
state?: SensorAssetState;
}
export class AlertNotification implements AlertNotificationInterface {
type: string;
subjectType: string;
name: string;
thresholdType: string;
from: Date;
to: Date;
opened: Date;
closed: Date;
length: number;
summary: any;
threshold: any;
notification: any;
projectInfo: any;
assetInfo: any;
sensorInfo: any;
sendAt: Date;
admins: Array<any>;
managers: Array<any>;
created: Date;
modified: Date;
deleted: Date;
id: any;
assetId: any;
assetStateId: any;
sensorId: any;
stateId: any;
asset?: Asset;
assetState?: AssetState;
trackingLogs?: Log[];
sensor?: Sensor;
state?: SensorAssetState;
constructor(data?: AlertNotificationInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `AlertNotification`.
*/
public static getModelName(): string {
return 'AlertNotification';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of AlertNotification for dynamic purposes.
*/
public static factory(data: AlertNotificationInterface): AlertNotification{
return new AlertNotification(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: 'AlertNotification',
plural: 'AlertNotifications',
path: 'AlertNotifications',
idName: 'id',
properties: {
type: {
name: 'type',
type: 'string'
},
subjectType: {
name: 'subjectType',
type: 'string'
},
name: {
name: 'name',
type: 'string'
},
thresholdType: {
name: 'thresholdType',
type: 'string'
},
from: {
name: 'from',
type: 'Date'
},
to: {
name: 'to',
type: 'Date'
},
opened: {
name: 'opened',
type: 'Date'
},
closed: {
name: 'closed',
type: 'Date'
},
length: {
name: 'length',
type: 'number'
},
summary: {
name: 'summary',
type: 'any'
},
threshold: {
name: 'threshold',
type: 'any'
},
notification: {
name: 'notification',
type: 'any'
},
projectInfo: {
name: 'projectInfo',
type: 'any'
},
assetInfo: {
name: 'assetInfo',
type: 'any'
},
sensorInfo: {
name: 'sensorInfo',
type: 'any'
},
sendAt: {
name: 'sendAt',
type: 'Date'
},
admins: {
name: 'admins',
type: 'Array<any>'
},
managers: {
name: 'managers',
type: 'Array<any>'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
id: {
name: 'id',
type: 'any'
},
assetId: {
name: 'assetId',
type: 'any'
},
assetStateId: {
name: 'assetStateId',
type: 'any'
},
sensorId: {
name: 'sensorId',
type: 'any'
},
stateId: {
name: 'stateId',
type: 'any'
},
},
relations: {
asset: {
name: 'asset',
type: 'Asset',
model: 'Asset',
relationType: 'belongsTo',
keyFrom: 'assetId',
keyTo: 'id'
},
assetState: {
name: 'assetState',
type: 'AssetState',
model: 'AssetState',
relationType: 'belongsTo',
keyFrom: 'assetStateId',
keyTo: 'id'
},
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
sensor: {
name: 'sensor',
type: 'Sensor',
model: 'Sensor',
relationType: 'belongsTo',
keyFrom: 'sensorId',
keyTo: 'id'
},
state: {
name: 'state',
type: 'SensorAssetState',
model: 'SensorAssetState',
relationType: 'belongsTo',
keyFrom: 'stateId',
keyTo: 'id'
},
}
};
}
}