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

export interface TrafficFlowAnalysisInterface {
  name: string;
  description?: string;
  edges?: Array<any>;
  created?: Date;
  modified?: Date;
  deleted?: Date;
  id?: any;
  projectId?: any;
  _kpis?: Array<any>;
  _vertices?: Array<any>;
  trackingLogs?: Log[];
  project?: Project;
  managers?: Manager[];
  kpis?: any[];
  vertices?: any[];
}

export class TrafficFlowAnalysis implements TrafficFlowAnalysisInterface {
  name: string;
  description: string;
  edges: Array<any> = [];
  created: Date;
  modified: Date;
  deleted: Date;
  id: any;
  projectId: any;
  _kpis: Array<any> = [];
  _vertices: Array<any> = [];
  trackingLogs?: Log[];
  project?: Project;
  managers?: Manager[];
  kpis?: any[];
  vertices?: any[];
  constructor(data?: TrafficFlowAnalysisInterface) {
    Object.assign(this, data);
  }

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

  /**
   * @method factory
   * @author Jonathan Casarrubias
   * @license MIT
   * This method creates an instance of TrafficFlowAnalysis for dynamic purposes.
   */
  public static factory(data: TrafficFlowAnalysisInterface): TrafficFlowAnalysis{
    return new TrafficFlowAnalysis(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: 'TrafficFlowAnalysis',
      plural: 'TrafficFlowAnalysis',
      path: 'TrafficFlowAnalysis',
      idName: 'id',
      properties: {
        name: {
          name: 'name',
          type: 'string'
        },
        description: {
          name: 'description',
          type: 'string'
        },
        edges: {
          name: 'edges',
          type: 'Array&lt;any&gt;',
          default: []
        },
        created: {
          name: 'created',
          type: 'Date'
        },
        modified: {
          name: 'modified',
          type: 'Date'
        },
        deleted: {
          name: 'deleted',
          type: 'Date',
          default: undefined
        },
        id: {
          name: 'id',
          type: 'any'
        },
        projectId: {
          name: 'projectId',
          type: 'any'
        },
        _kpis: {
          name: '_kpis',
          type: 'Array&lt;any&gt;',
          default: []
        },
        _vertices: {
          name: '_vertices',
          type: 'Array&lt;any&gt;',
          default: []
        },
      },
      relations: {
        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'
        },
        managers: {
          name: 'managers',
          type: 'Manager[]',
          model: 'Manager',
          relationType: 'hasMany',
          modelThrough: 'ManagerTrafficFlowAnalysis',
          keyThrough: 'managerId',
          keyFrom: 'id',
          keyTo: 'trafficFlowAnalysisId'
        },
        kpis: {
          name: 'kpis',
          type: 'any[]',
          model: '',
          relationType: 'embedsMany',
          keyFrom: '_kpis',
          keyTo: 'id'
        },
        vertices: {
          name: 'vertices',
          type: 'any[]',
          model: '',
          relationType: 'embedsMany',
          keyFrom: '_vertices',
          keyTo: 'id'
        },
      }
    };
  }
}
