import request from '@/config/axios'

export interface bindDeviceVO {
  deviceType: string
  deviceCode: string
  elderId: number
  organizationId: number
  installPosition: string
}

export interface unbindDeviceVO {
  deviceCode: string
  elderId: number
}

export interface addElderVO {
  name: string
  address: string
  gender: number
}

// 添加长者
export const addElder = (data: addElderVO) => {
  return request.post({ url: '/api/pc/admin/addElder', data })
}

// 绑定设备
export const bindDevice = (data: bindDeviceVO) => {
  return request.post({ url: '/api/pc/admin/bindDevice', data })
}

// 解绑设备
export const unbindDevice = (data: unbindDeviceVO) => {
  return request.post({ url: '/api/pc/admin/unbindDevice', data })
}

// 获取设备详情
export const getDeviceDetail = (deviceCode: string) => {
  return request.get({ url: '/api/pc/admin/getDeviceDetail?deviceCode = ' + deviceCode })
}

// 获取统计数据
export const getStatistics = (organizationId) => {
  return request.get({ url: '/v2/api/smarthome/getStatistics?organizationId=' + organizationId })
}

// 获取长者列表
export const getElderList = (organizationId) => {
  return request.get({ url: '/v2/api/smarthome/getElderList?organizationId' + organizationId })
}

// 获取长者设备信息
export const getElderDeviceMessage = (elderId: number) => {
  return request.get({ url: '/v2/api/smarthome/elder/deviceMessage?elderId=' + elderId })
}

// 获取长者设备信息
export const getAllWarning = () => {
  return request.get({ url: '/v2/api/smarthome/getAllWarning' })
}
