import request from '@/config/axios'

// 巡检路线 VO
export interface IotInspectRouteVO {
  id: number // 主键id
  routeName: string // 路线名称
  deviceClassify: number // 设备分类
  deviceId: number // 设备id
  deviceClassifyName: string // 设备分类名称
  deviceName: string // 设备名称
  itemJson: string // 巡检项
  remark: string // 备注
  deptId: number // 部门id
}

// 巡检路线 API
export const IotInspectRouteApi = {
  // 查询巡检路线分页
  getIotInspectRoutePage: async (params: any) => {
    return await request.get({ url: `/rq/iot-inspect-route/page`, params })
  },
  getDeviceIotInspectRoutePage: async (params: any) => {
    return await request.get({ url: `/rq/iot-inspect-route/plan/page`, params })
  },
  // 查询巡检路线详情
  getIotInspectRoute: async (id: number) => {
    return await request.get({ url: `/rq/iot-inspect-route/get?id=` + id })
  },

  // 新增巡检路线
  createIotInspectRoute: async (data: IotInspectRouteVO) => {
    return await request.post({ url: `/rq/iot-inspect-route/create`, data })
  },

  // 修改巡检路线
  updateIotInspectRoute: async (data: IotInspectRouteVO) => {
    return await request.put({ url: `/rq/iot-inspect-route/update`, data })
  },

  // 删除巡检路线
  deleteIotInspectRoute: async (id: number) => {
    return await request.delete({ url: `/rq/iot-inspect-route/delete?id=` + id })
  },

  // 导出巡检路线 Excel
  exportIotInspectRoute: async (params) => {
    return await request.download({ url: `/rq/iot-inspect-route/export-excel`, params })
  },
}
