import request from '@/utils/request'

// 查询广播分区列表
export function listBroadcastZone(query) {
  return request({
    url: '/broadcast/system/zone/list',
    method: 'get',
    params: query
  })
}

// 查询广播分区详细
export function getBroadcastZone(id) {
  return request({
    url: '/broadcast/system/zone/' + id,
    method: 'get'
  })
}

// 新增广播分区
export function addBroadcastZone(data) {
  return request({
    url: '/broadcast/system/zone',
    method: 'post',
    data: data
  })
}

// 修改广播分区
export function updateBroadcastZone(data) {
  return request({
    url: '/broadcast/system/zone',
    method: 'put',
    data: data
  })
}

// 删除广播分区
export function delBroadcastZone(id) {
  return request({
    url: '/broadcast/system/zone/' + id,
    method: 'delete'
  })
}

// 导出广播分区
export function exportBroadcastZone(query) {
  return request({
    url: '/broadcast/system/zone/export',
    method: 'post',
    params: query
  })
}

// 更新音量和静音状态
export function updateZoneVolume(data) {
  return request({
    url: '/broadcast/system/zone/volume',
    method: 'post',
    data: data
  })
}

// 控制广播播放
export function controlBroadcast(data) {
  return request({
    url: '/broadcast/system/zone/control',
    method: 'post',
    data: data
  })
}

// 紧急广播
export function emergencyBroadcast(data) {
  return request({
    url: '/broadcast/system/zone/emergency',
    method: 'post',
    data: data
  })
}

// 查询广播设备列表
export function listBroadcastDevice(query) {
  return request({
    url: '/broadcast/system/device/list',
    method: 'get',
    params: query
  })
}

// 根据分区ID查询设备
export function getZoneDevices(zoneId) {
  return request({
    url: '/broadcast/system/device/zone/' + zoneId,
    method: 'get'
  })
}

// 查询广播设备详细
export function getBroadcastDevice(id) {
  return request({
    url: '/broadcast/system/device/' + id,
    method: 'get'
  })
}

// 新增广播设备
export function addBroadcastDevice(data) {
  return request({
    url: '/broadcast/system/device',
    method: 'post',
    data: data
  })
}

// 修改广播设备
export function updateBroadcastDevice(data) {
  return request({
    url: '/broadcast/system/device',
    method: 'put',
    data: data
  })
}

// 删除广播设备
export function delBroadcastDevice(id) {
  return request({
    url: '/broadcast/system/device/' + id,
    method: 'delete'
  })
}

// 导出广播设备
export function exportBroadcastDevice(query) {
  return request({
    url: '/broadcast/system/device/export',
    method: 'post',
    params: query
  })
}

// 查询广播内容列表
export function listBroadcastContent(query) {
  return request({
    url: '/broadcast/system/content/list',
    method: 'get',
    params: query
  })
}

// 获取广播内容（根据类型）
export function getBroadcastContent(query) {
  return request({
    url: '/broadcast/system/content/list',
    method: 'get',
    params: query
  })
}

// 查询广播内容详细
export function getBroadcastContentDetail(id) {
  return request({
    url: '/broadcast/system/content/' + id,
    method: 'get'
  })
}

// 新增广播内容
export function addBroadcastContent(data) {
  return request({
    url: '/broadcast/system/content',
    method: 'post',
    data: data
  })
}

// 修改广播内容
export function updateBroadcastContent(data) {
  return request({
    url: '/broadcast/system/content',
    method: 'put',
    data: data
  })
}

// 删除广播内容
export function delBroadcastContent(id) {
  return request({
    url: '/broadcast/system/content/' + id,
    method: 'delete'
  })
}