import {ModelDefinition} from './BaseModels';
import {Asset} from './Asset';
import {Log} from './Log';
import {Project} from './Project';
declare var Object: any;

export interface HealthcheckEventInterface {
  currentState?: string;
  seen: boolean;
  expiresAt?: Date;
  healthStatus?: string;
  created?: Date;
  modified?: Date;
  deleted?: Date;
  id?: any;
  assetId?: any;
  _comments?: Array<any>;
  _stateChanges?: Array<any>;
  _data?: any;
  projectId?: any;
  asset?: Asset;
  comments?: any[];
  stateChanges?: any[];
  data?: any[];
  trackingLogs?: Log[];
  project?: Project;
}

export class HealthcheckEvent implements HealthcheckEventInterface {
  currentState: string = 'OPENED';
  seen: boolean;
  expiresAt: Date;
  healthStatus: string;
  created: Date;
  modified: Date;
  deleted: Date;
  id: any;
  assetId: any;
  _comments: Array<any> = [];
  _stateChanges: Array<any> = [];
  _data: any;
  projectId: any;
  asset?: Asset;
  comments?: any[];
  stateChanges?: any[];
  data?: any[];
  trackingLogs?: Log[];
  project?: Project;
  constructor(data?: HealthcheckEventInterface) {
    Object.assign(this, data);
  }

  /**
   * The name of the model represented by this $resource,
   * i.e. `HealthcheckEvent`.
   */
  public static getModelName(): string {
    return 'HealthcheckEvent';
  }

  /**
   * @method factory
   * @author Jonathan Casarrubias
   * @license MIT
   * This method creates an instance of HealthcheckEvent for dynamic purposes.
   */
  public static factory(data: HealthcheckEventInterface): HealthcheckEvent{
    return new HealthcheckEvent(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: 'HealthcheckEvent',
      plural: 'HealthcheckEvents',
      path: 'HealthcheckEvents',
      idName: 'id',
      properties: {
        currentState: {
          name: 'currentState',
          type: 'string',
          default: 'OPENED'
        },
        seen: {
          name: 'seen',
          type: 'boolean'
        },
        expiresAt: {
          name: 'expiresAt',
          type: 'Date'
        },
        healthStatus: {
          name: 'healthStatus',
          type: 'string'
        },
        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'
        },
        _comments: {
          name: '_comments',
          type: 'Array&lt;any&gt;',
          default: []
        },
        _stateChanges: {
          name: '_stateChanges',
          type: 'Array&lt;any&gt;',
          default: []
        },
        _data: {
          name: '_data',
          type: 'any'
        },
        projectId: {
          name: 'projectId',
          type: 'any'
        },
      },
      relations: {
        asset: {
          name: 'asset',
          type: 'Asset',
          model: 'Asset',
          relationType: 'belongsTo',
          keyFrom: 'assetId',
          keyTo: 'id'
        },
        comments: {
          name: 'comments',
          type: 'any[]',
          model: '',
          relationType: 'embedsMany',
          keyFrom: '_comments',
          keyTo: 'id'
        },
        stateChanges: {
          name: 'stateChanges',
          type: 'any[]',
          model: '',
          relationType: 'embedsMany',
          keyFrom: '_stateChanges',
          keyTo: 'id'
        },
        data: {
          name: 'data',
          type: 'any[]',
          model: '',
          relationType: 'embedsOne',
          keyFrom: '_data',
          keyTo: 'id'
        },
        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'
        },
      }
    };
  }
}
