import {request} from '@/utils/request.js'

/**
 * 分页查询告警
 */
export function getWarningByPage(data) {
  return request({
    url: '/warning/page',
    method: 'GET',
    params: data
  })
}

/**
 * 列表查询告警
 */
export function getWarningByList(data) {
  return request({
    url: '/warning',
    method: 'GET',
    params: data
  })
}

/**
 * 列表查询待处理告警
 */
export function getWarningWaitingByList(data) {
  return request({
    url: '/warning/waiting',
    method: 'GET',
    params: data
  })
}

/**
 * 我的待处理告警TOP
 */
export function getMyWarningWaitingTop(limit) {
  return request({
    url: `/warning/myWaiting/top/${limit}`,
    method: 'GET'
  })
}

/**
 * 基于ID查询告警
 */
export function getWarningById(warnId) {
  return request({
    url: `/warning/${warnId}`,
    method: 'GET'
  })
}

/**
 * 完成处理
 * @param data
 * @returns
 */
export function completeWarning(data) {
  return request({
    url: `/warning/complete`,
    method: 'POST',
    data
  })
}

/**
 * 转交他人
 * @param warnId
 * @param data
 * @returns
 */
export function transferWarning(warnId, data) {
  return request({
    url: `/warning/transfer/${warnId}`,
    method: 'POST',
    data
  })
}

/**
 * 撤消
 * @param warnId
 * @returns
 */
export function cancelWarning(warnId) {
  return request({
    url: `/warning/cancel/${warnId}`,
    method: 'GET'
  })
}

/**
 * 删除
 */
export function deleteWarningById(warnId) {
  return request({
    url: `/warning/${warnId}`,
    method: 'DELETE'
  })
}
