import request from '@/config/axios'

// 计量器具-证书管理 VO
export interface IotMeasureCertVO {
  id: number // 主键id
  type: string // 证书类型
  classify: string // 证书类别
  certBelong: string // 证书所属公司/个人
  certOrg: string // 证书颁发机构
  certStandard: string // 证书标准
  certIssue: Date // 证书颁发时间
  certExpire: Date // 证书有效期
  noticeBefore: number // 到期前提醒
  certPic: string // 证书图片上传
  remark: string // 备注
  deptId: number // 部门id
}

// 计量器具-证书管理 API
export const IotMeasureCertApi = {
  // 查询计量器具-证书管理分页
  getIotMeasureCertPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-measure-cert/page`, params })
  },

  // 查询计量器具-证书管理详情
  getIotMeasureCert: async (id: number) => {
    return await request.get({ url: `/rq/iot-measure-cert/get?id=` + id })
  },

  // 新增计量器具-证书管理
  createIotMeasureCert: async (data: IotMeasureCertVO) => {
    return await request.post({ url: `/rq/iot-measure-cert/create`, data })
  },

  // 修改计量器具-证书管理
  updateIotMeasureCert: async (data: IotMeasureCertVO) => {
    return await request.put({ url: `/rq/iot-measure-cert/update`, data })
  },

  // 删除计量器具-证书管理
  deleteIotMeasureCert: async (id: number) => {
    return await request.delete({ url: `/rq/iot-measure-cert/delete?id=` + id })
  },

  // 导出计量器具-证书管理 Excel
  exportIotMeasureCert: async (params) => {
    return await request.download({ url: `/rq/iot-measure-cert/export-excel`, params })
  }
}

// 计量器具台账 VO
export const IotInstrumentApi = {
  // 获得计量器具台账分页
  getInstrumentList: async (params) => {
    return await request.get({ url: `rq/iot-measure-book/page`, params })
  },
  // 删除计量器具台账
  deleteInstrument: async (id) => {
    return await request.delete({ url: `/rq/iot-measure-book/delete?id=` + id })
  },
  // 更新计量器具台账
  updateInstrument: async (data) => {
    return await request.put({ url: `/rq/iot-measure-book/update`, data })
  },
  // 新增计量器具台账
  createInstrument: async (data) => {
    return await request.post({ url: `/rq/iot-measure-book/create`, data })
  },
  // 导出计量器具台账 Excel
  exportInstrument: async (params) => {
    return await request.download({ url: `/rq/iot-measure-book/export-excel`, params })
  }
}

// 计量器具-检测校准明细 VO
export interface IotMeasureDetectVO {
  id: number // 主键id
  measureId: number // 计量器具id
  detectDate: string // 检测/校准日期
  detectOrg: string // 检测/校准机构
  detectContent: string // 检测/校准内容
  validityPeriod: Date // 检测/校准有效期
  detectAmount: number // 校准金额
  deptId: number // 部门id
}

// 计量器具-检测校准明细 API
export const IotMeasureDetectApi = {
  // 查询计量器具-检测校准明细分页
  getIotMeasureDetectPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-measure-detect/page`, params })
  },

  // 查询计量器具-检测校准明细详情
  getIotMeasureDetect: async (id: number) => {
    return await request.get({ url: `/rq/iot-measure-detect/get?id=` + id })
  },

  // 新增计量器具-检测校准明细
  createIotMeasureDetect: async (data: IotMeasureDetectVO) => {
    return await request.post({ url: `/rq/iot-measure-detect/create`, data })
  },

  // 修改计量器具-检测校准明细
  updateIotMeasureDetect: async (data: IotMeasureDetectVO) => {
    return await request.put({ url: `/rq/iot-measure-detect/update`, data })
  },

  // 删除计量器具-检测校准明细
  deleteIotMeasureDetect: async (id: number) => {
    return await request.delete({ url: `/rq/iot-measure-detect/delete?id=` + id })
  },

  // 导出计量器具-检测校准明细 Excel
  exportIotMeasureDetect: async (params) => {
    return await request.download({ url: `/rq/iot-measure-detect/export-excel`, params })
  }
}

// 计量器具-使用记录 VO
export interface IotMeasureRecordVO {
  id: number // 主键id
  measureId: number // 计量器具id
  useDate: string // 使用日期
  useReason: string // 使用原因
  measureProject: string // 计量项目
  usePerson: string // 使用人
  userId: number // 使用人id
  deptId: number // 部门id
}

// 计量器具-使用记录 API
export const IotMeasureRecordApi = {
  // 查询计量器具-使用记录分页
  getIotMeasureRecordPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-measure-record/page`, params })
  },

  // 查询计量器具-使用记录详情
  getIotMeasureRecord: async (id: number) => {
    return await request.get({ url: `/rq/iot-measure-record/get?id=` + id })
  },

  // 新增计量器具-使用记录
  createIotMeasureRecord: async (data: IotMeasureRecordVO) => {
    return await request.post({ url: `/rq/iot-measure-record/create`, data })
  },

  // 修改计量器具-使用记录
  updateIotMeasureRecord: async (data: IotMeasureRecordVO) => {
    return await request.put({ url: `/rq/iot-measure-record/update`, data })
  },

  // 删除计量器具-使用记录
  deleteIotMeasureRecord: async (id: number) => {
    return await request.delete({ url: `/rq/iot-measure-record/delete?id=` + id })
  },

  // 导出计量器具-使用记录 Excel
  exportIotMeasureRecord: async (params) => {
    return await request.download({ url: `/rq/iot-measure-record/export-excel`, params })
  }
}

// 危险源管理
export const IotDangerApi = {
  // 获得危险源分页
  getDangerList: async (params) => {
    return await request.get({ url: `/rq/iot-danger-source/page`, params })
  },
  // 删除危险源
  deleteDanger: async (id) => {
    return await request.delete({ url: `/rq/iot-danger-source/delete?id=` + id })
  },
  // 添加危险源
  createDanger: async (data) => {
    return await request.post({ url: `/rq/iot-danger-source/create`, data })
  },
  // 修改危险源
  updateDanger: async (data) => {
    return await request.put({ url: `/rq/iot-danger-source/update`, data })
  },
  // 导出危险源 Excel
  exportDanger: async (params) => {
    return await request.download({ url: `/rq/iot-danger-source/export-excel`, params })
  }
}

// 环境因素识别
export const IotEnvironmentApi = {
  // 获得环境因素分页
  getEnvironmentList: async (params) => {
    return await request.get({ url: `/rq/iot-environment-recognize/page`, params })
  },
  // 删除环境因素
  deleteEnvironment: async (id) => {
    return await request.delete({ url: `/rq/iot-environment-recognize/delete?id=` + id })
  },

  // 添加环境因素
  createEnvironment: async (data) => {
    return await request.post({ url: `/rq/iot-environment-recognize/create`, data })
  },
  // 修改环境因素
  updateEnvironment: async (data) => {
    return await request.put({ url: `/rq/iot-environment-recognize/update`, data })
  },
  // 导出环境因素 Excel
  exportEnvironment: async (params) => {
    return await request.download({ url: `/rq/iot-environment-recognize/export-excel`, params })
  }
}

// 故障上报
export const IotFailureApi = {
  // 获得故障上报分页
  getFailureList: async (params) => {
    return await request.get({ url: `/rq/iot-accident-report/page`, params })
  },
  // 删除故障上报
  deleteFailure: async (id) => {
    return await request.delete({ url: `/rq/iot-accident-report/delete?id=` + id })
  },
  // 添加故障上报
  createFailure: async (data) => {
    return await request.post({ url: `/rq/iot-accident-report/create`, data })
  },
  // 导出
  exportFailure: async (params) => {
    return await request.download({ url: `/rq/iot-accident-report/export-excel`, params })
  },

  // 修改故障上报
  updateFailure: async (data) => {
    return await request.put({ url: `/rq/iot-accident-report/update`, data })
  },

  // 获取详情
  getFailure: async (id) => {
    return await request.get({ url: `/rq/iot-accident-report/get?id=` + id })
  }
}

// 上报审批
export const IotApprovalApi = {
  // 获得上报审批分页
  getApprovalList: async (params) => {
    return await request.get({ url: `/rq/iot-accident-report/approval/page`, params })
  },

  // 流转信息
  getApprovalProcess: async (id) => {
    return await request.get({ url: `/rq/iot-accident-report-process/page?accidentId=` + id })
  },

  // 添加上报审批
  createApproval: async (params) => {
    return await request.get({ url: `/rq/iot-accident-report/approval`, params })
  }
}

// 隐患排查
export const IotHiddenApi = {
  // 获得隐患排查分页
  getHiddenList: async (params) => {
    return await request.get({ url: `/rq/iot-hazard/page`, params })
  },
  // 删除隐患排查
  deleteHidden: async (id) => {
    return await request.delete({ url: `/rq/iot-hazard/delete?id=` + id })
  },
  // 添加隐患排查
  createHidden: async (data) => {
    return await request.post({ url: `/rq/iot-hazard/create`, data })
  },
  // 修改隐患排查
  updateHidden: async (data) => {
    return await request.put({ url: `/rq/iot-hazard/update`, data })
  },
  // 导出隐患排查 Excel
  exportHidden: async (params) => {
    return await request.download({ url: `/rq/iot-hazard/export-excel`, params })
  },
  // 整改
  rectifyHidden: async (data) => {
    return await request.put({ url: `/rq/iot-hazard/rectify`, data })
  }
}

// SOC数据源分析
export const IotSocApi = {
  // 获得SOC数据源分析分页
  getSocList: async (params) => {
    return await request.get({ url: `/rq/iot-soc-source/page`, params })
  },
  // 删除SOC数据源分析
  deleteSoc: async (id) => {
    return await request.delete({ url: `/rq/iot-soc-source/delete?id=` + id })
  },
  // 获取上级分类
  getParentCategory: async () => {
    return await request.get({ url: `/rq/iot-soc-source/simple-list` })
  },
  // 查询SOC分类详情
  getSocClassify: async (id: number) => {
    return await request.get({ url: `/rq/iot-soc-source/get?id=` + id })
  },
  // 添加SOC数据源分析
  createSoc: async (data) => {
    return await request.post({ url: `/rq/iot-soc-source/create`, data })
  },
  // 修改SOC数据源分析
  updateSoc: async (data) => {
    return await request.put({ url: `/rq/iot-soc-source/update`, data })
  }
}

// SOC卡汇总
export const IotSocSummaryApi = {
  // 获得SOC卡汇总分页
  getIotSocSummaryPage: async (params) => {
    return await request.get({ url: `/rq/iot-soc-summary/page`, params })
  },
  // 删除SOC卡汇总
  deleteIotSocSummary: async (id) => {
    return await request.delete({ url: `/rq/iot-soc-summary/delete?id=` + id })
  },
  // 添加SOC卡汇总
  createIotSocSummary: async (data) => {
    return await request.post({ url: `/rq/iot-soc-summary/create`, data })
  },
  // 修改SOC卡汇总
  updateIotSocSummary: async (data) => {
    return await request.put({ url: `/rq/iot-soc-summary/update`, data })
  },
  // 导出SOC卡汇总 Excel
  exportIotSocSummary: async (params) => {
    return await request.download({ url: `/rq/iot-soc-summary/export-excel`, params })
  },
  // 获取详情
  getIotSocSummary: async (id) => {
    return await request.get({ url: `/rq/iot-soc-summary/get?id=` + id })
  }
}
