import request from '@/utils/request'
interface Fault {
  MaxResultCount?: number | string
  SkipCount?: number | string
  Filter?: string
}
interface Resource extends Fault {
  ProductId?: string
}
// 获取文档列表
export const getDocumentsByProductId = (params: Resource) =>
  request.get('/api/services/app/DocumentLibrary/GetDocumentsByProductId', { params })

/**
 * 获取故障列表
 * @param params
 * @returns
 */
export const getFaultList = (params: Fault) => request.get('/api/services/app/FaultLibrary/GetFaultList', { params })

/**
 * 获取设备下分组及变量数据
 * @param params
 * @returns
 */
export const getDeviceGroupAndVariables = (params: any) =>
  request.get('/api/services/app/Variable/GetDeviceGroupAndVariables', { params })

/**
 * 报警比例
 * @param params
 * @returns
 */
export const getAlertReportForCustom = (params: any) =>
  request.get('/api/services/app/Report/GetAlertReportForCustom', { params })

/**
 * 设备详情
 * @param params
 * @returns
 */
export const getDeviceInfoDetails = (params: any) => request.get('/api/services/app/Devices/GetDeviceInfo', { params })

/**
 * 设备寿命
 * @param params
 * @returns
 */
export const getAllList = (params: any) => request.get('/api/services/app/EquipmentLife/GetAllList', { params })

/**
 * 获取分组及所属变量信息
 * @param params
 * @returns
 */
export const getGroupAndVariables = (params: any) =>
  request.get('/api/services/app/RealTime/GetGroupAndVariables', { params })

/**
 * 获取设备视频监控列表
 * @param params
 * @returns
 */
export const getDeviceMonitors = (params: any) =>
  request.get('/api/services/app/Monitors/GetDeviceMonitors', { params })

/**
 * 获取设备视频监控列表
 * @param params deviceId 设备Id  channelNo 通道 startTime endTime
 * @returns
 */
export const getDeviceVideos = (params: any) => request.get('/api/services/app/Monitors/GetDeviceVideos', { params })

/**
 * 获取设备寿命
 * @param params
 * @returns
 */
export const getEquipmentLifes = (params: any) =>
  request.get('/api/services/app/EquipmentLife/GetEquipmentLifes', { params })

/**
 * 更换 设备
 * @param params lifeId  设备寿命Id
 * @returns
 */
export const putEquipmentChange = (data: any) => request.post('/api/services/app/EquipmentLife/EquipmentChange', data)

/**
 * 获取备品备件
 * @param params DeviceId 设备Id
 * @returns
 */
export const getSpareParts = (params: any) => request.get('/api/services/app/SparePart/GetSpareParts', { params })

/**
 * 维保
 * @param params DeviceId 设备Id
 * @returns
 */
export const getMaintenancePlans = (params: any) =>
  request.get('/api/services/app/MaintenancePlan/GetMaintenancePlans', { params })

/**
 *  维修记录
 * @param params planId  设备寿命Id
 * @returns
 */
export const getRepairListByDevice = (params: any) =>
  request.get('/api/services/app/Repair/GetRepairListByDevice', { params })

/**
 *  年度报警记录
 * @param params planId  设备寿命Id
 * @returns
 */
export const getAlertReportForYear = (params: any) =>
  request.get('/api/services/app/Report/GetAlertReportForYear', { params })

/**
 *  月度报警记录
 * @param params planId  设备寿命Id
 * @returns
 */
export const getAlertReportForMonth = (params: any) =>
  request.get('/api/services/app/Report/GetAlertReportForMonth', { params })

/**
 *   全部维保计划
 * @param params Filter
 * @returns
 */
export const getMaintenancePlanAllList = (params: any) =>
  request.get('/api/services/app/MaintenancePlan/GetAllMaintenancePlans', { params })

/**
 *   设备寿命
 * @param params Filter
 * @returns
 */
export const getAllEquipmentLifes = (params: any) =>
  request.get('/api/services/app/EquipmentLife/GetAllEquipmentLifes', { params })

/**
 *  实时报警
 * @param params Keyword
 * @returns
 */
export const getAllRealTimeAlert = (params: any) =>
  request.get('/api/services/app/VariableRecord/GetAllRealTimeAlert', { params })

/**
 *  历史报警
 * @param params Keyword
 * @returns
 */
export const getAllAlertRecords = (params: any) =>
  request.get('/api/services/app/VariableRecord/GetAllAlertRecords', { params })

/**
 *  维修记录
 * @returns
 */
export const getDeviceRepairLogs = (params: any) =>
  request.get('/api/services/app/DeviceAuthorize/GetDeviceRepairLogs', { params })

/**
 *  获取工单详情
 * @returns
 */
export const getRepairInfo = (params: any) => request.get('/api/services/app/Repair/GetRepairInfo', { params })

/**
 * 获取未读消息数量
 * @param params type  1 2 3 4 5 6
 * @returns
 */
export const getUserNotifications = (params: any) =>
  request.get('/api/services/app/Notification/GetUserUnReadNotificationCount', { params })
/**
 *  设置消息已读
 * @returns
 */
export const setAllNotificationsAsRead = () => request.post('/api/services/app/Notification/SetAllNotificationsAsRead')

/**
 *  设置消息已读
 * @returns
 */
export const getDutyCycleLineChart = (params: any) =>
  request.get('/api/services/app/Report/GetDutyCycleLineChart', { params })

/**
 *  工作循环列表
 * @returns
 */
export const getDutyCycleReport = (params: any) =>
  request.get('/api/services/app/Report/GetDutyCycleReport', { params })

/**
 *  工作循环列表
 * @returns
 */
export const getTodoRepairList = (params: any) => request.get('/api/services/app/Repair/GetTodoRepairList', { params })

/**
 *  获取报修人员
 * @returns
 */
export const searchRepairer = (params: any) => request.post('/api/services/app/Repair/SearchRepairer', { ...params })

/**
 *  派单
 * @returns
 */
export const assignRepair = (params: any) => request.post('/api/services/app/Repair/AssignRepair', { ...params })

/**
 *  标记已完成
 * @returns
 */
export const markCompleted = (params: any) => request.post('/api/services/app/Repair/MarkCompleted', { ...params })

/**
 *  接单
 * @returns
 */
export const acceptRepair = (params: any) => request.post('/api/services/app/Repair/AcceptRepair', { ...params })

/**
 *  反馈
 * @returns
 */
export const feedbackRepair = (params: any) => request.post('/api/services/app/Repair/FeedbackRepair', { ...params })

/**
 *  驳回
 * @returns
 */
export const auditRepair = (params: any) => request.post('/api/services/app/Repair/AuditRepair', { ...params })

/**
 *  完工
 * @returns
 */
export const submitRepair = (params: any) => request.post('/api/services/app/Repair/SubmitRepair', { ...params })
/**
 *  业务记录
 * @returns
 */
export const getMyWorkRepairList = (params: any) =>
  request.get('/api/services/app/Repair/GetMyWorkRepairList', { params })

/**
 * 更换设备
 * @param lifeId 设备寿命Id
 * @returns
 */
export const equipmentChange = (lifeId: any) =>
  request.post('/api/services/app/EquipmentLife/EquipmentChange', { lifeId })

/**
 * 维保
 * @param planId 设备寿命Id
 * @returns
 */
export const dealWithPlan = (planId: any) => request.post('/api/services/app/MaintenancePlan/DealWithPlan', { planId })

/**
 * 设置消息已读, 除报警消息外
 * @param id 消息id
 * @returns
 */
export const setNotificationAsRead = (id: any) =>
  request.post('/api/services/app/Notification/SetNotificationAsRead', { id })
