import request from '@/utils/request'

// 查询报警点列表
export function listAlarmPoints(query) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/list',
        method: 'get',
        params: query
    })
}

// 查询报警点详细
export function getAlarmPoint(pointId) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/' + pointId,
        method: 'get'
    })
}

// 新增报警点
export function addAlarmPoint(data) {
    return request({
        url: '/subsystem/intrusion/alarmpoints',
        method: 'post',
        data: data
    })
}

// 修改报警点
export function updateAlarmPoint(data) {
    return request({
        url: '/subsystem/intrusion/alarmpoints',
        method: 'put',
        data: data
    })
}

// 删除报警点
export function delAlarmPoint(pointId) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/' + pointId,
        method: 'delete'
    })
}

// 导出报警点
export function exportAlarmPoint(query) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/export',
        method: 'post',
        params: query
    })
}

// 切换布防状态
export function toggleArmStatus(data) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/arm',
        method: 'post',
        data: data
    })
}

// 批量布防/撤防
export function batchArmControl(data) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/batch-arm',
        method: 'post',
        data: data
    })
}

// 测试报警设备
export function testAlarmDevice(deviceCode) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/test/' + deviceCode,
        method: 'post'
    })
}

// 更新设备配置
export function updateDeviceConfig(data) {
    return request({
        url: '/subsystem/intrusion/alarmpoints/config',
        method: 'put',
        data: data
    })
}

// 查询报警记录列表
export function listAlarms(query) {
    return request({
        url: '/subsystem/intrusion/alarms/list',
        method: 'get',
        params: query
    })
}

// 查询报警记录详细
export function getAlarm(alarmId) {
    return request({
        url: '/subsystem/intrusion/alarms/' + alarmId,
        method: 'get'
    })
}

// 处理报警
export function processAlarm(data) {
    return request({
        url: '/subsystem/intrusion/alarms/process',
        method: 'put',
        data: data
    })
}

// 批量处理报警
export function batchProcessAlarms(data) {
    return request({
        url: '/subsystem/intrusion/alarms/batch-process',
        method: 'put',
        data: data
    })
}

// 确认报警
export function confirmAlarm(alarmId) {
    return request({
        url: '/subsystem/intrusion/alarms/confirm/' + alarmId,
        method: 'put'
    })
}

// 忽略报警
export function ignoreAlarm(alarmId, data) {
    return request({
        url: '/subsystem/intrusion/alarms/ignore/' + alarmId,
        method: 'put',
        data: data
    })
}

// 查询防区列表
export function listZones(query) {
    return request({
        url: '/subsystem/intrusion/zones/list',
        method: 'get',
        params: query
    })
}

// 查询防区详细
export function getZone(zoneId) {
    return request({
        url: '/subsystem/intrusion/zones/' + zoneId,
        method: 'get'
    })
}

// 新增防区
export function addZone(data) {
    return request({
        url: '/subsystem/intrusion/zones',
        method: 'post',
        data: data
    })
}

// 修改防区
export function updateZone(data) {
    return request({
        url: '/subsystem/intrusion/zones',
        method: 'put',
        data: data
    })
}

// 删除防区
export function delZone(zoneId) {
    return request({
        url: '/subsystem/intrusion/zones/' + zoneId,
        method: 'delete'
    })
}

// 防区布防/撤防
export function toggleZoneStatus(zoneId, data) {
    return request({
        url: '/subsystem/intrusion/zones/toggle/' + zoneId,
        method: 'put',
        data: data
    })
}

// 批量防区操作
export function batchZoneControl(data) {
    return request({
        url: '/subsystem/intrusion/zones/batch-control',
        method: 'post',
        data: data
    })
}

// 查询防区设备列表
export function listZoneDevices(zoneCode) {
    return request({
        url: '/subsystem/intrusion/zones/devices/' + zoneCode,
        method: 'get'
    })
}

// 添加设备到防区
export function addDeviceToZone(data) {
    return request({
        url: '/subsystem/intrusion/zones/add-device',
        method: 'post',
        data: data
    })
}

// 从防区移除设备
export function removeDeviceFromZone(data) {
    return request({
        url: '/subsystem/intrusion/zones/remove-device',
        method: 'post',
        data: data
    })
}

// 查询联动规则列表
export function listLinkageRules(query) {
    return request({
        url: '/subsystem/intrusion/linkage/list',
        method: 'get',
        params: query
    })
}

// 新增联动规则
export function addLinkageRule(data) {
    return request({
        url: '/subsystem/intrusion/linkage',
        method: 'post',
        data: data
    })
}

// 修改联动规则
export function updateLinkageRule(data) {
    return request({
        url: '/subsystem/intrusion/linkage',
        method: 'put',
        data: data
    })
}

// 删除联动规则
export function delLinkageRule(ruleId) {
    return request({
        url: '/subsystem/intrusion/linkage/' + ruleId,
        method: 'delete'
    })
}

// 启用/禁用联动规则
export function toggleLinkageRule(ruleId, data) {
    return request({
        url: '/subsystem/intrusion/linkage/toggle/' + ruleId,
        method: 'put',
        data: data
    })
}

// 查询联动执行记录
export function listLinkageRecords(query) {
    return request({
        url: '/subsystem/intrusion/linkage/records/list',
        method: 'get',
        params: query
    })
}

// 手动执行联动
export function executeLinkage(data) {
    return request({
        url: '/subsystem/intrusion/linkage/execute',
        method: 'post',
        data: data
    })
}

// 获取报警统计数据
export function getAlarmStatistics(query) {
    return request({
        url: '/subsystem/intrusion/statistics',
        method: 'get',
        params: query
    })
}

// 获取实时状态
export function getRealTimeStatus() {
    return request({
        url: '/subsystem/intrusion/realtime/status',
        method: 'get'
    })
}

// 获取报警趋势数据
export function getAlarmTrend(query) {
    return request({
        url: '/subsystem/intrusion/statistics/trend',
        method: 'get',
        params: query
    })
}

// 设备健康检测
export function checkDeviceHealth(deviceCode) {
    return request({
        url: '/subsystem/intrusion/health/check/' + deviceCode,
        method: 'post'
    })
}

// 批量设备健康检测
export function batchCheckDeviceHealth(deviceCodes) {
    return request({
        url: '/subsystem/intrusion/health/batch-check',
        method: 'post',
        data: { deviceCodes: deviceCodes }
    })
}

// 获取设备配置
export function getDeviceConfig(deviceCode) {
    return request({
        url: '/subsystem/intrusion/config/' + deviceCode,
        method: 'get'
    })
}

// 重置设备
export function resetDevice(deviceCode) {
    return request({
        url: '/subsystem/intrusion/device/reset/' + deviceCode,
        method: 'post'
    })
}

// 查询维护记录
export function listMaintenanceRecords(query) {
    return request({
        url: '/subsystem/intrusion/maintenance/list',
        method: 'get',
        params: query
    })
}

// 新增维护记录
export function addMaintenanceRecord(data) {
    return request({
        url: '/subsystem/intrusion/maintenance',
        method: 'post',
        data: data
    })
}

// 导出报警记录
export function exportAlarms(query) {
    return request({
        url: '/subsystem/intrusion/alarms/export',
        method: 'post',
        params: query
    })
}

// 生成报警报表
export function generateAlarmReport(query) {
    return request({
        url: '/subsystem/intrusion/report/generate',
        method: 'post',
        params: query
    })
}

// 数据同步
export function syncIntrusionData(data) {
    return request({
        url: '/subsystem/intrusion/sync',
        method: 'post',
        data: data
    })
}