import request from '@/utils/request'

export function listWorkAlertPushConfig(query) {
  return request({
    url: '/system/workAlertPushConfig/list',
    method: 'get',
    params: query
  })
}

export function getWorkAlertPushConfig(id) {
  return request({
    url: '/system/workAlertPushConfig/' + id,
    method: 'get'
  })
}

export function listPushTypes() {
  return request({
    url: '/system/workAlertPushConfig/pushTypes',
    method: 'get'
  })
}

export function addWorkAlertPushConfig(data) {
  return request({
    url: '/system/workAlertPushConfig',
    method: 'post',
    data
  })
}

export function updateWorkAlertPushConfig(data) {
  return request({
    url: '/system/workAlertPushConfig',
    method: 'put',
    data
  })
}

export function delWorkAlertPushConfig(id) {
  const ids = Array.isArray(id) ? id.join(',') : id
  return request({
    url: '/system/workAlertPushConfig/' + ids,
    method: 'delete'
  })
}

export function triggerWorkAlertPush(id) {
  return request({
    url: '/system/workAlertPushConfig/trigger/' + id,
    method: 'post'
  })
}
