import request from '@/utils/request.js'

//大屏获取设备信息
export const getLargeScreen = (tunnelId) => {
  return request({
    url: `/tunnel/large/screen/equipment/${tunnelId}`,
    method: 'get'
  })
}
//大屏信息接口
export const getLargeScreenInfo = () => {
  return request({
    url: '/tunnel/large/screen/info',
    method: 'get'
  })
}
//通过站点id获取隧道信息
export const getTunnelBySiteId = (siteId) => {
  return request({
    url: `/tunnel/large/screen/tunnel/option/${siteId}`,
    method: 'get'
  })
}
// 传感器echarts数据
export const getEchartsInfo = (id,time,type,startTime,endTime) => {
  return request({
    url: '/tunnel/large/screen/echarts/sensor',
    method: 'get',
    params: {
      id: id,
      time: time,
      type: type,
      startTime:startTime,
      endTime:endTime,
    }
  })
}
// 有害气体echarts数据
export const getBadGasEchartsInfo = (id,time,type,startTime,endTime) => {
  return request({
    url: '/tunnel/large/screen/echarts/gas/sensor',
    method: 'get',
    params: {
      id: id,
      time: time,
      type: type,
      startTime:startTime,
      endTime:endTime,
    }
  })
}
//电流监控数据
export const getFanEchartsInfo = (id,time,type,startTime,endTime) => {
  return request({
    url: '/tunnel/large/screen/echarts/current',
    method: 'get',
    params: {
      id: id,
      time: time,
      type: type,
      startTime:startTime,
      endTime:endTime,
    }
  })
}
//用电量echarts
export const getEleEchartsInfo = (id,time,type) => {
  return request({
    url: '/tunnel/large/screen/echarts/electricity/consumption',
    method: 'get',
    params: {
      id: id,
      time: time,
      type: type
    }
  })
}
//风机频率修改
export const editFrequency = (data) => {
  return request({
    url: '/tunnel/large/screen/frequency',
    method: 'put',
    data
  })
}
//风机运行模式切换
export const editFrequencyModelSwitch = (data) => {
  return request({
    url: '/tunnel/large/screen/model/switch',
    method: 'post',
    data
  })
}
//风机开关切换
export const editFrequencyOperationSwitch = (data) => {
  return request({
    url: '/tunnel/large/screen/operation/switch',
    method: 'post',
    data
  })
}
export const getAlarmInfo = (params) => {
  return request({
    url: '/tunnel/alarm',
    method: 'get',
    params
  })
}
export const getAlarmDetail = (alarmId) => {
  return request({
    url: '/tunnel/alarm/details',
    method: 'get',
    params:{
      alarmId:alarmId
    }
  })
}
export const updateAlarmState = (data) => {
  return request({
    url: '/tunnel/alarm',
    method: 'put',
    data
  })
}
export const deleteAlarmSate = (tunnelAlarmIdList) => {
  return request({
    url: `/tunnel/alarm/${tunnelAlarmIdList}`,
    method: 'delete'
  })
}
// 传感器模拟echarts数据
export const getSimulationEchartsInfo = (id,time,type,startTime,endTime) => {
  return request({
    url: '/tunnel/simulation/large/screen/echarts/sensor',
    method: 'get',
    params: {
      id: id,
      time: time,
      type: type,
      startTime:startTime,
      endTime:endTime,
    }
  })
}
// 有害气体模拟echarts数据
export const getSimulationBadGasEchartsInfo = (id,time,type,startTime,endTime) => {
  return request({
    url: '/tunnel/simulation/large/screen/echarts/gas/sensor',
    method: 'get',
    params: {
      id: id,
      time: time,
      type: type,
      startTime:startTime,
      endTime:endTime,
    }
  })
}
//开始 模拟
export const startSimulation = (projectId) => {
  return request({
    url: `/tunnel/simulation/start/${projectId}`,
    method: 'get'
  })
}
//模拟状态
export const simulationState = (projectId) => {
  return request({
    url: `/tunnel/simulation/state/${projectId}`,
    method: 'get'
  })
}
// 结束模拟
export const endSimulation = (projectId) => {
  return request({
    url: `/tunnel/simulation/stop/${projectId}`,
    method: 'get'
  })
}
//模拟爆破
export const blastingSimulation = (projectId,level) => {
  return request({
    url: `/tunnel/simulation/blasting/${projectId}/${level}`,
    method: 'get'
  })
}