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

export interface AssetStaffInterface {
  name: string;
  description?: string;
  type: string;
  referenceId?: string;
  created?: Date;
  modified?: Date;
  deleted?: Date;
  id?: any;
  assetId?: any;
  asset?: Asset;
  trackingLogs?: Log[];
}

export class AssetStaff implements AssetStaffInterface {
  name: string;
  description: string;
  type: string;
  referenceId: string;
  created: Date;
  modified: Date;
  deleted: Date;
  id: any;
  assetId: any;
  asset?: Asset;
  trackingLogs?: Log[];
  constructor(data?: AssetStaffInterface) {
    Object.assign(this, data);
  }

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

  /**
   * @method factory
   * @author Jonathan Casarrubias
   * @license MIT
   * This method creates an instance of AssetStaff for dynamic purposes.
   */
  public static factory(data: AssetStaffInterface): AssetStaff{
    return new AssetStaff(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: 'AssetStaff',
      plural: 'AssetStaffs',
      path: 'AssetStaffs',
      idName: 'id',
      properties: {
        name: {
          name: 'name',
          type: 'string'
        },
        description: {
          name: 'description',
          type: 'string'
        },
        type: {
          name: 'type',
          type: 'string'
        },
        referenceId: {
          name: 'referenceId',
          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'
        },
      },
      relations: {
        asset: {
          name: 'asset',
          type: 'Asset',
          model: 'Asset',
          relationType: 'belongsTo',
          keyFrom: 'assetId',
          keyTo: 'id'
        },
        trackingLogs: {
          name: 'trackingLogs',
          type: 'Log[]',
          model: 'Log',
          relationType: 'hasMany',
          keyFrom: 'id',
          keyTo: 'trackingModelId'
        },
      }
    };
  }
}
