import request from '@/config/axios'

// 设备负责人 VO
export interface ResponsibleVO {
  id: number // 主键
  deviceId: number // 设备ID
  userId: string // 负责人ID
  userName: string // 负责人姓名
  userCode: string // 负责人工号
  responsibilityType: string // 责任类型(负责人/管理员等)
  remark: string // 备注
}

// 设备负责人 API
export const ResponsibleApi = {
  // 查询设备负责人分页
  getResponsiblePage: async (params: any) => {
    return await request.get({ url: `/device/responsible/page`, params })
  },

  // 查询设备负责人详情
  getResponsible: async (id: number) => {
    return await request.get({ url: `/device/responsible/get?id=` + id })
  },

  // 新增设备负责人
  createResponsible: async (data: ResponsibleVO) => {
    return await request.post({ url: `/device/responsible/create`, data })
  },

  // 修改设备负责人
  updateResponsible: async (data: ResponsibleVO) => {
    return await request.put({ url: `/device/responsible/update`, data })
  },

  // 删除设备负责人
  deleteResponsible: async (id: number) => {
    return await request.delete({ url: `/device/responsible/delete?id=` + id })
  },

  // 导出设备负责人 Excel
  exportResponsible: async (params) => {
    return await request.download({ url: `/device/responsible/export-excel`, params })
  },
}
