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

export interface SuperAdminInterface {
  name?: string;
  created?: Date;
  modified?: Date;
  deleted?: Date;
  otpEnabled?: boolean;
  disabledPasswordLogin?: boolean;
  username?: string;
  email: string;
  emailVerified?: boolean;
  id?: any;
  countryId?: any;
  timeZoneId?: any;
  password?: string;
  accessTokens?: any[];
  activityLogs?: Log[];
  trackingLogs?: Log[];
  loginAttempts?: any[];
  country?: Country;
  timeZone?: TimeZone;
}

export class SuperAdmin implements SuperAdminInterface {
  name: string;
  created: Date;
  modified: Date;
  deleted: Date;
  otpEnabled: boolean;
  disabledPasswordLogin: boolean;
  username: string;
  email: string;
  emailVerified: boolean;
  id: any;
  countryId: any;
  timeZoneId: any;
  password: string;
  accessTokens?: any[];
  activityLogs?: Log[];
  trackingLogs?: Log[];
  loginAttempts?: any[];
  country?: Country;
  timeZone?: TimeZone;
  constructor(data?: SuperAdminInterface) {
    Object.assign(this, data);
  }

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

  /**
   * @method factory
   * @author Jonathan Casarrubias
   * @license MIT
   * This method creates an instance of SuperAdmin for dynamic purposes.
   */
  public static factory(data: SuperAdminInterface): SuperAdmin{
    return new SuperAdmin(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: 'SuperAdmin',
      plural: 'SuperAdmins',
      path: 'SuperAdmins',
      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
        },
        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'
        },
        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'
        },
        country: {
          name: 'country',
          type: 'Country',
          model: 'Country',
          relationType: 'belongsTo',
          keyFrom: 'countryId',
          keyTo: 'id'
        },
        timeZone: {
          name: 'timeZone',
          type: 'TimeZone',
          model: 'TimeZone',
          relationType: 'belongsTo',
          keyFrom: 'timeZoneId',
          keyTo: 'id'
        },
      }
    };
  }
}
