import request from '@/utils/request'
import { download } from '@/utils/request'

// 查询报警配置列表
export function listAlarmConfig(query) {
    return request({
        url: '/AlarmRule/AlarmRule/list',
        method: 'get',
        params: query
    })
}

// 查询报警配置详细信息
export function getAlarmConfig(alarmId) {
    return request({
        url: '/AlarmRule/AlarmRule/' + alarmId,
        method: 'get'
    })
}

// 新增报警配置
export function addAlarmConfig(data) {
    return request({
        url: '/AlarmRule/AlarmRule',
        method: 'post',
        data: data
    })
}

// 修改报警配置
export function updateAlarmConfig(data) {
    return request({
        url: '/AlarmRule/AlarmRule',
        method: 'put',
        data: data
    })
}

// 删除报警配置
export function delAlarmConfig(alarmId) {
    return request({
        url: '/AlarmRule/AlarmRule/' + alarmId,
        method: 'delete'
    })
}

// 导出报警配置列表
export function downloadAlarmConfig(data) {
    download(
        '/AlarmRule/AlarmRule/export',
        data,
        `alarm_${new Date().getTime()}.xlsx`)
}
