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

export interface YoloClassInterface {
  name: string;
  created?: Date;
  modified?: Date;
  deleted?: Date;
  id?: any;
  trackingLogs?: Log[];
}

export class YoloClass implements YoloClassInterface {
  name: string;
  created: Date;
  modified: Date;
  deleted: Date;
  id: any;
  trackingLogs?: Log[];
  constructor(data?: YoloClassInterface) {
    Object.assign(this, data);
  }

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

  /**
   * @method factory
   * @author Jonathan Casarrubias
   * @license MIT
   * This method creates an instance of YoloClass for dynamic purposes.
   */
  public static factory(data: YoloClassInterface): YoloClass{
    return new YoloClass(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: 'YoloClass',
      plural: 'YoloClasses',
      path: 'YoloClasses',
      idName: 'id',
      properties: {
        name: {
          name: 'name',
          type: 'string'
        },
        created: {
          name: 'created',
          type: 'Date'
        },
        modified: {
          name: 'modified',
          type: 'Date'
        },
        deleted: {
          name: 'deleted',
          type: 'Date',
          default: undefined
        },
        id: {
          name: 'id',
          type: 'any'
        },
      },
      relations: {
        trackingLogs: {
          name: 'trackingLogs',
          type: 'Log[]',
          model: 'Log',
          relationType: 'hasMany',
          keyFrom: 'id',
          keyTo: 'trackingModelId'
        },
      }
    };
  }
}
