@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
144 lines (138 loc) • 3.26 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Customer} from './Customer';
import {GlobalEventState} from './GlobalEventState';
import {Log} from './Log';
declare var Object: any;
export interface EventStateInterface {
name: string;
description?: string;
type: string;
colors: any;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
customerId?: any;
globalEventStateId?: any;
customer?: Customer;
globalEventState?: GlobalEventState;
trackingLogs?: Log[];
}
export class EventState implements EventStateInterface {
name: string;
description: string;
type: string;
colors: any;
created: Date;
modified: Date;
deleted: Date;
id: any;
customerId: any;
globalEventStateId: any;
customer?: Customer;
globalEventState?: GlobalEventState;
trackingLogs?: Log[];
constructor(data?: EventStateInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `EventState`.
*/
public static getModelName(): string {
return 'EventState';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of EventState for dynamic purposes.
*/
public static factory(data: EventStateInterface): EventState{
return new EventState(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: 'EventState',
plural: 'EventStates',
path: 'EventStates',
idName: 'id',
properties: {
name: {
name: 'name',
type: 'string'
},
description: {
name: 'description',
type: 'string'
},
type: {
name: 'type',
type: 'string'
},
colors: {
name: 'colors',
type: 'any'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
id: {
name: 'id',
type: 'any'
},
customerId: {
name: 'customerId',
type: 'any'
},
globalEventStateId: {
name: 'globalEventStateId',
type: 'any'
},
},
relations: {
customer: {
name: 'customer',
type: 'Customer',
model: 'Customer',
relationType: 'belongsTo',
keyFrom: 'customerId',
keyTo: 'id'
},
globalEventState: {
name: 'globalEventState',
type: 'GlobalEventState',
model: 'GlobalEventState',
relationType: 'belongsTo',
keyFrom: 'globalEventStateId',
keyTo: 'id'
},
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
}
};
}
}