import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
import {Credential} from './Credential';
import {Customer} from './Customer';
import {Country} from './Country';
import {Asset} from './Asset';
import {CctvDashboard} from './CctvDashboard';
import {CountReport} from './CountReport';
import {EventDashboard} from './EventDashboard';
import {PeopleCounterReport} from './PeopleCounterReport';
import {Report} from './Report';
import {StoreVideoAnalyticDashboard} from './StoreVideoAnalyticDashboard';
import {TimeZone} from './TimeZone';
import {TrafficFlowAnalysis} from './TrafficFlowAnalysis';
import {View} from './View';
declare var Object: any;

export interface ManagerInterface {
  name: string;
  surname?: string;
  phone?: string;
  address?: string;
  birthday?: Date;
  created?: Date;
  modified?: Date;
  deleted?: Date;
  otpEnabled?: boolean;
  disabledPasswordLogin?: boolean;
  username?: string;
  email: string;
  emailVerified?: boolean;
  id?: any;
  customerId?: any;
  countryId?: any;
  timeZoneId?: any;
  password?: string;
  accessTokens?: any[];
  activityLogs?: Log[];
  trackingLogs?: Log[];
  loginAttempts?: any[];
  credentials?: Credential[];
  customer?: Customer;
  country?: Country;
  assets?: Asset[];
  cctvDashboards?: CctvDashboard[];
  countReports?: CountReport[];
  eventDashboards?: EventDashboard[];
  container?: any;
  peopleCounterReports?: PeopleCounterReport[];
  permission?: any;
  reports?: Report[];
  storeVideoAnalyticDashboards?: StoreVideoAnalyticDashboard[];
  timeZone?: TimeZone;
  trafficFlowAnalysis?: TrafficFlowAnalysis[];
  views?: View[];
}

export class Manager implements ManagerInterface {
  name: string;
  surname: string;
  phone: string;
  address: string;
  birthday: Date;
  created: Date;
  modified: Date;
  deleted: Date;
  otpEnabled: boolean;
  disabledPasswordLogin: boolean;
  username: string;
  email: string;
  emailVerified: boolean;
  id: any;
  customerId: any;
  countryId: any;
  timeZoneId: any;
  password: string;
  accessTokens?: any[];
  activityLogs?: Log[];
  trackingLogs?: Log[];
  loginAttempts?: any[];
  credentials?: Credential[];
  customer?: Customer;
  country?: Country;
  assets?: Asset[];
  cctvDashboards?: CctvDashboard[];
  countReports?: CountReport[];
  eventDashboards?: EventDashboard[];
  container?: any;
  peopleCounterReports?: PeopleCounterReport[];
  permission?: any;
  reports?: Report[];
  storeVideoAnalyticDashboards?: StoreVideoAnalyticDashboard[];
  timeZone?: TimeZone;
  trafficFlowAnalysis?: TrafficFlowAnalysis[];
  views?: View[];
  constructor(data?: ManagerInterface) {
    Object.assign(this, data);
  }

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

  /**
   * @method factory
   * @author Jonathan Casarrubias
   * @license MIT
   * This method creates an instance of Manager for dynamic purposes.
   */
  public static factory(data: ManagerInterface): Manager{
    return new Manager(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: 'Manager',
      plural: 'Managers',
      path: 'Managers',
      idName: 'id',
      properties: {
        name: {
          name: 'name',
          type: 'string'
        },
        surname: {
          name: 'surname',
          type: 'string'
        },
        phone: {
          name: 'phone',
          type: 'string'
        },
        address: {
          name: 'address',
          type: 'string'
        },
        birthday: {
          name: 'birthday',
          type: 'Date'
        },
        created: {
          name: 'created',
          type: 'Date'
        },
        modified: {
          name: 'modified',
          type: 'Date'
        },
        deleted: {
          name: 'deleted',
          type: 'Date',
          default: undefined
        },
        otpEnabled: {
          name: 'otpEnabled',
          type: 'boolean'
        },
        disabledPasswordLogin: {
          name: 'disabledPasswordLogin',
          type: 'boolean'
        },
        username: {
          name: 'username',
          type: 'string'
        },
        email: {
          name: 'email',
          type: 'string'
        },
        emailVerified: {
          name: 'emailVerified',
          type: 'boolean'
        },
        id: {
          name: 'id',
          type: 'any'
        },
        customerId: {
          name: 'customerId',
          type: 'any'
        },
        countryId: {
          name: 'countryId',
          type: 'any'
        },
        timeZoneId: {
          name: 'timeZoneId',
          type: 'any'
        },
        password: {
          name: 'password',
          type: 'string'
        },
      },
      relations: {
        accessTokens: {
          name: 'accessTokens',
          type: 'any[]',
          model: '',
          relationType: 'hasMany',
          keyFrom: 'id',
          keyTo: 'userId'
        },
        activityLogs: {
          name: 'activityLogs',
          type: 'Log[]',
          model: 'Log',
          relationType: 'hasMany',
          keyFrom: 'id',
          keyTo: 'userId'
        },
        trackingLogs: {
          name: 'trackingLogs',
          type: 'Log[]',
          model: 'Log',
          relationType: 'hasMany',
          keyFrom: 'id',
          keyTo: 'trackingModelId'
        },
        loginAttempts: {
          name: 'loginAttempts',
          type: 'any[]',
          model: '',
          relationType: 'hasMany',
          keyFrom: 'id',
          keyTo: 'userId'
        },
        credentials: {
          name: 'credentials',
          type: 'Credential[]',
          model: 'Credential',
          relationType: 'hasMany',
          modelThrough: 'CredentialManager',
          keyThrough: 'credentialId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        customer: {
          name: 'customer',
          type: 'Customer',
          model: 'Customer',
          relationType: 'belongsTo',
          keyFrom: 'customerId',
          keyTo: 'id'
        },
        country: {
          name: 'country',
          type: 'Country',
          model: 'Country',
          relationType: 'belongsTo',
          keyFrom: 'countryId',
          keyTo: 'id'
        },
        assets: {
          name: 'assets',
          type: 'Asset[]',
          model: 'Asset',
          relationType: 'hasMany',
          modelThrough: 'ManagerAsset',
          keyThrough: 'assetId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        cctvDashboards: {
          name: 'cctvDashboards',
          type: 'CctvDashboard[]',
          model: 'CctvDashboard',
          relationType: 'hasMany',
          modelThrough: 'ManagerCctvDashboard',
          keyThrough: 'cctvDashboardId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        countReports: {
          name: 'countReports',
          type: 'CountReport[]',
          model: 'CountReport',
          relationType: 'hasMany',
          modelThrough: 'ManagerCountReport',
          keyThrough: 'countReportId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        eventDashboards: {
          name: 'eventDashboards',
          type: 'EventDashboard[]',
          model: 'EventDashboard',
          relationType: 'hasMany',
          modelThrough: 'ManagerEventDashboard',
          keyThrough: 'eventDashboardId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        container: {
          name: 'container',
          type: 'any',
          model: '',
          relationType: 'hasOne',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        peopleCounterReports: {
          name: 'peopleCounterReports',
          type: 'PeopleCounterReport[]',
          model: 'PeopleCounterReport',
          relationType: 'hasMany',
          modelThrough: 'ManagerPeopleCounterReport',
          keyThrough: 'peopleCounterReportId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        permission: {
          name: 'permission',
          type: 'any',
          model: '',
          relationType: 'hasOne',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        reports: {
          name: 'reports',
          type: 'Report[]',
          model: 'Report',
          relationType: 'hasMany',
          modelThrough: 'ManagerReport',
          keyThrough: 'reportId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        storeVideoAnalyticDashboards: {
          name: 'storeVideoAnalyticDashboards',
          type: 'StoreVideoAnalyticDashboard[]',
          model: 'StoreVideoAnalyticDashboard',
          relationType: 'hasMany',
          modelThrough: 'ManagerStoreVideoAnalyticDashboard',
          keyThrough: 'storeVideoAnalyticDashboardId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        timeZone: {
          name: 'timeZone',
          type: 'TimeZone',
          model: 'TimeZone',
          relationType: 'belongsTo',
          keyFrom: 'timeZoneId',
          keyTo: 'id'
        },
        trafficFlowAnalysis: {
          name: 'trafficFlowAnalysis',
          type: 'TrafficFlowAnalysis[]',
          model: 'TrafficFlowAnalysis',
          relationType: 'hasMany',
          modelThrough: 'ManagerTrafficFlowAnalysis',
          keyThrough: 'trafficFlowAnalysisId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
        views: {
          name: 'views',
          type: 'View[]',
          model: 'View',
          relationType: 'hasMany',
          modelThrough: 'ManagerView',
          keyThrough: 'viewId',
          keyFrom: 'id',
          keyTo: 'managerId'
        },
      }
    };
  }
}
