export interface Ipaging {
  page: number;
  size: number;
}
export interface IpagingRes<T> {
  size: number
  current: number
  total: number
  pages: number
  records: T[]
}

interface TRoleMenu {
  id?: number
  type?: number
  name?: string
  createTime?: string
}
export interface TRoleList {
  id?: number
  name: string
  createTime?: string
  roleMenu?: TRoleMenu[]
}
export interface TbindWeb {
  devices: number[]
  accountId: number
}
export interface TAccountSetStatus {
  accountId: number
  status: number
}

export interface TStatisticsCount {
  addCount: number
  deviceTotal: number
  onlineCount: number
  warnCount: number
}

export interface statisticsContentReq {
  type: string
  startDate: string
  endDate: string
}

export interface statisticsContentRes {
  sosCount: number
  railCount: number
  destroyCount: number
  batteryCount: number
  heartRateCount: number
  bloodOxygenCount: number
  tempCount: number
  times: any[],
  sosArr: any[],
  railArr: any[],
  destroyArr: any[],
  healthArr: any[],
}

export interface TWarningConfirm {
  id?: number | string
  name: string
  username: string
  content: string
  images: string[]
}

export interface TDeviceConfigModify {
  deviceId: string | string[]
  userNumber: string
  minHr: number
  maxHr: number
  minBo: number
  minTemp: number
  maxTemp: number
  contacts: any[]
}


export namespace TRoleModify {
  export interface Ireq {
    id?: number
    name: string
    roleMenu: TRoleMenu[]
    menus?: TRoleMenu[]
  }
}

export namespace TDeviceConfig {

  interface Treq {
    deviceId: string | string[]
  }
  interface Tcontacts {
    name: string
    phone: string
  }
  interface Tres {
    deviceId: string | string[]
    userNumber: string
    minHr: number
    minBo: number
    minTemp: number
    maxTemp: number
    maxHr: number
    name?: string
    phone?: string
    contacts: Tcontacts[]
  }
}

export namespace TLogin {
  export interface Ireq {
    username: string;
    password: string;
  }

  export interface IRes {
    orgId: string
    orgName: string
    roleId: number
    token: string
    username: string
    warnMusic: number
  }

}

export namespace TAccount {
  export interface IAdd {
    username: string;
    phone: string;
    name: string;
    orgId?: number | string;
    roleId: number | string;
    status: number;
  }
  export interface IListReq extends Ipaging {
    orgId?: number;
  }
  export interface Idel {
    id: number;
  }
  export interface IResetPwd {
    id: number;
    password: string;
  }
  export interface IListRes {
    id: number
    orgId: number
    roleId: number
    status: number
    flag: boolean
    name: string
    username: string
    password: string
    phone: string
    orgName: string
    updateUser: string
    updateTime: string
    creatUser: string
    createTime: string
  }

}
export namespace TDevice {

  export interface IListReq extends Ipaging {
    orgId?: number;
  }
  export interface IListRes {
    id: number
    deviceId: number
    accountId: number
    orgId: number
    status: number
    useStatus: number
    deviceSwitch: number
    mode: number
    monitorMode: number
    battery: number
    otaFlag: number
    adminUsername: string
    adminPhone: string
    userNumber: string
    adminType: string
    name: string
    username: string
    password: string
    phone: string
    orgName: string
    deviceVersion: string
    updateUser: string
    updateTime: string
    creatUser: string
    createTime: string
  }

  export interface ISetMonitor {
    deviceId: number;
    mode?: number;
    cmd?: string;
  }

  export interface IRecordReq extends Ipaging {
    deviceId?: any;
  }
  export interface IRecordRes {
    id: number
    deviceId: number
    accountId: number
    orgId: number
    status: number
    deviceSwitch: number
    mode: number
    monitorMode: number
    battery: number
    name: string
    username: string
    password: string
    phone: string
    orgName: string
    deviceVersion: string
    updateUser: string
    updateTime: string
    creatUser: string
    createTime: string
  }
  export interface IUseRecordRes {
    id: number
    accountId: number
    userNumber: string
    adminName: string
    adminType: string
    deviceId: string
    phone: string
    orgId: number
    orgName: string
    status: number
    updateUser: string
    updateTime: string
    creatUser: string
    createTime: string
  }
  export interface IWarningRecordRes {
    id: number
    userNumber: string
    deviceId: string
    warnType: number
    status: number
    updateUser: string
    updateTime: string
    creatUser: string
    createTime: string
  }

}


export namespace TOrg {
  export interface IAdd {
    name: string;
    rails: string;
    parentId: string;
  }
  export interface IListReq extends Ipaging {
    name?: string;
  }
  export interface Idel {
    id: number;
  }
  export interface IOrgRecordRes {
    id: number
    name: string
    parentId: number
    status: number
    updateUser: string
    updateTime: string
    creatUser: string
    createTime: string
  }
}

export interface TstatisticsUseCount {
  defaultCount: number;
  monitorCount: number;
  outsideCount: number;
}
export namespace TWarnRecord {

  export interface IListReq extends Ipaging {
    deviceId?: string;
    warnType?: number;
    status?: number;
  }

  export interface IListRes {
    id: number
    userNumber: string
    deviceId: string
    warnType: number
    type: number
    address: string
    lng: number
    lat: number
    status: number
    updateUser: string
    updateTime: string
    creatUser: string
    createTime: string
    rimg: string
    rname: string
    rcontent: string
  }
}

export namespace TWarningDetail {
  interface TParams {
    id: number | string
  }
  interface THealthData {
    bo: number
    hr: number
    temp: number
    time: number
  }
  interface TRes {
    address: string
    adminName: string
    adminPhone: string
    creatUser: string
    createTime: string
    deviceId: string
    healthData: THealthData[]
    id: number
    lat: number
    lng: number
    maxValue: number
    minValue: number
    rcontent: string
    rimg: any
    rname: string
    status: number
    type: number
    updateTime: string
    updateUser: string
    userNumber: string
    username: string
    value: string
    orgName: string
    warnType: number
  }
}

export namespace THealthLatestData {

  interface TReq {
    deviceId: number | string
  }
  interface TRes {
    hr: number
    hrTime: string
    hrArr: any[],
    bo: number
    boArr: any[],
    boTime: string
    temp: number
    tempTime: string
    tempArr: any[]
  }
}
export namespace TLocateRecord {

  interface TReq {
    deviceId: number | string
    startDate: string
    endDate: string
  }
  interface TRes {
    id: number
    deviceId: string
    lat: number
    lng: number
    locationType: number
    adCode: string
    place: string
    address: string
    locationTime: string
    createTime: string
  }
}

export namespace TSetUseStatus {
  interface TReq {
    status: number
    deviceId: number
  }
}
export namespace TRoleMenuList {
  interface TMenus {
    id: number
    type: number
    name: string
    createTime: string
  }

  interface TRes {
    name: string
    type: number
    menus: TMenus[]
  }
}

