import request from '@/config/axios'

// 抄表记录 VO
export interface EnergyDeviceCheckRecordVO {
  id: number // ID
  deviceId: number // 能源设备Id
  lastCheckTime: Date // 上次抄表时间
  lastCheckValue: number // 上次抄表值
  checkValue: number // 抄表值
  checkTime: Date // 抄表时间
  diffValue: number // 差值
  unitPrice: number // 单价
  remark: string // 备注
}

// 抄表记录 API
export const EnergyDeviceCheckRecordApi = {
  // 查询抄表记录分页
  getEnergyDeviceCheckRecordPage: async (params: any) => {
    return await request.get({ url: `/mes/energy-device-check-record/page`, params })
  },

  // 查询抄表记录详情
  getEnergyDeviceCheckRecord: async (id: number) => {
    return await request.get({ url: `/mes/energy-device-check-record/get?id=` + id })
  },

  // 新增抄表记录
  createEnergyDeviceCheckRecord: async (data: EnergyDeviceCheckRecordVO) => {
    return await request.post({ url: `/mes/energy-device-check-record/create`, data })
  },

  // 修改抄表记录
  updateEnergyDeviceCheckRecord: async (data: EnergyDeviceCheckRecordVO) => {
    return await request.put({ url: `/mes/energy-device-check-record/update`, data })
  },

  // 删除抄表记录
  deleteEnergyDeviceCheckRecord: async (id: number) => {
    return await request.delete({ url: `/mes/energy-device-check-record/delete?id=` + id })
  },

  // 导出抄表记录 Excel
  exportEnergyDeviceCheckRecord: async (params) => {
    return await request.download({ url: `/mes/energy-device-check-record/export-excel`, params })
  }
}