import request from '@/utils/request'

// 查询设备告警列表
export function listDeviceAlarm(query) {
    return request({
        url: '/device/alarm/list',
        method: 'get',
        params: query
    })
}

// 查询设备告警详细
export function getDeviceAlarm(id) {
    return request({
        url: '/device/alarm/' + id,
        method: 'get'
    })
}

// 获取告警详情（包含处理记录）
export function getAlarmDetail(id) {
    return request({
        url: '/device/alarm/detail/' + id,
        method: 'get'
    })
}

// 新增设备告警
export function addDeviceAlarm(data) {
    return request({
        url: '/device/alarm',
        method: 'post',
        data: data
    })
}

// 修改设备告警
export function updateDeviceAlarm(data) {
    return request({
        url: '/device/alarm',
        method: 'put',
        data: data
    })
}

// 删除设备告警
export function delDeviceAlarm(id) {
    return request({
        url: '/device/alarm/' + id,
        method: 'delete'
    })
}

// 导出设备告警
export function exportDeviceAlarm(query) {
    return request({
        url: '/device/alarm/export',
        method: 'post',
        params: query
    })
}

// 复位告警
export function resetAlarm(data) {
    return request({
        url: '/device/alarm/reset',
        method: 'post',
        data: data
    })
}

// 创建服务单
export function createServiceOrder(data) {
    return request({
        url: '/device/alarm/createOrder',
        method: 'post',
        data: data
    })
}