import request from '@/utils/request'

//获取单个站点的信息
export function getDzjkHomeView(siteId) {
  return request({
    url: `/ems/siteMonitor/homeView?siteId=${siteId}`,
    method: 'get'
  })
}
//站点首页 冲放曲线
export function getSevenChargeData({siteId,startDate,endDate}) {
  return request({
    url: `/ems/siteMap/getSevenChargeData?siteId=${siteId}&startDate=${startDate}&endDate=${endDate}`,
    method: 'get'
  })
}

//获取pcs、实时运行头部的设备信息
export function getRunningHeadInfo(siteId) {
  return request({
    url: `/ems/siteMonitor/runningHeadInfo?siteId=${siteId}`,
    method: 'get'
  })
}
//获取pcs列表
export function getPcsDetailInfo(siteId) {
  return request({
    url: `/ems/siteMonitor/getPcsDetailInfo?siteId=${siteId}`,
    method: 'get'
  })
}

//获取BMS总览数据
export function getBMSOverView(siteId) {
  return request({
    url: `/ems/siteMonitor/getBMSOverView?siteId=${siteId}`,
    method: 'get'
  })
}

//获取BMS电池簇总览数据
export function getBMSBatteryCluster(siteId) {
  return request({
    url: `/ems/siteMonitor/getBMSBatteryCluster?siteId=${siteId}`,
    method: 'get'
  })
}

//获取单体电池 电池堆列表数据
export function getStackNameList(siteId) {
  return request({
    url: `/ems/siteMonitor/getStackNameList?siteId=${siteId}`,
    method: 'get'
  })
}
//获取单体电池 电池簇列表数据
export function getClusterNameList({stackDeviceId,siteId}) {
  return request({
    url: `/ems/siteMonitor/getClusterNameList?stackDeviceId=${stackDeviceId}&siteId=${siteId}`,
    method: 'get'
  })
}
//单体电池表格数据
export function getClusterDataInfoList({siteId, stackDeviceId, clusterDeviceId,batteryId, pageSize, pageNum}) {
  return request({
    url: `/ems/siteMonitor/getClusterDataInfoList?clusterDeviceId=${clusterDeviceId}&siteId=${siteId}&stackDeviceId=${stackDeviceId}&batteryId=${batteryId}&pageSize=${pageSize}&pageNum=${pageNum}`,
    method: 'get'
  })
}
// 单体电池图表
//http://localhost:8089/ems/siteMonitor/getSingleBatteryData?clusterDeviceId=BMSC01&siteId=021_FXX_01&deviceId=001&startDate=2025-07-11&endDate=2025-07-18
export function getSingleBatteryData({siteId,deviceId,clusterDeviceId,startDate,endDate}) {
  return request({
    url: `/ems/siteMonitor/getSingleBatteryData?siteId=${siteId}&deviceId=${deviceId}&startDate=${startDate}&endDate=${endDate}&clusterDeviceId=${clusterDeviceId}`,
    method: 'get'
  })
}

//获取液冷列表数据
export function getCoolingDataList(siteId) {
  return request({
    url: `/ems/siteMonitor/getCoolingDataList?siteId=${siteId}`,
    method: 'get'
  })
}

//获取电表数据
export function getAmmeterDataList(siteId) {
  return request({
    url: `/ems/siteMonitor/getAmmeterDataList?siteId=${siteId}`,
    method: 'get'
  })
}

// 故障告警
export function getAlarmDetailList({status,siteId, deviceId, alarmLevel, alarmStartTime, alarmEndTime,pageSize,pageNum}) {
  return request({
    url: `/ems/siteAlarm/getAlarmDetailList?siteId=${siteId}&status=${status}&deviceId=${deviceId}&alarmLevel=${alarmLevel}&alarmStartTime=${alarmStartTime}&alarmEndTime=${alarmEndTime}&pageSize=${pageSize}&pageNum=${pageNum}`,
    method: 'get'
  })
}

// 概率统计
//获取概率统计 电量指标接口
export function getElectricData({siteId,startDate,endDate}) {
  return request({
    url: `/ems/statsReport/getElectricData?siteId=${siteId}&startDate=${startDate}&endDate=${endDate}`,
    method: 'get'
  })
}
//获取pcs列表
export function getPcsNameList(siteId) {
  return request({
    url: `/ems/siteMonitor/getPcsNameList?siteId=${siteId}`,
    method: 'get'
  })
}
//pcs曲线
export function getPCSData({siteId,deviceId,startTime,endTime,dataType}) {
  return request({
    url: `/ems/statsReport/getPCSData?siteId=${siteId}&deviceId=${deviceId}&startDate=${startTime}&endDate=${endTime}&dataType=${dataType}`,
    method: 'get'
  })
}
//电池堆曲线
export function getStackData({siteId,deviceId,startTime,endTime,dataType}) {
  return request({
    url: `/ems/statsReport/getStackData?siteId=${siteId}&deviceId=${deviceId}&startDate=${startTime}&endDate=${endTime}&dataType=${dataType}`,
    method: 'get'
  })
}
//电池温度
export function getClusterData({siteId,stackId,clusterId,dateTime,pageNum,pageSize}) {
  return request({
    url: `/ems/statsReport/getClusterData?siteId=${siteId}&stackId=${stackId}&clusterId=${clusterId}&dateTime=${dateTime}&pageNum=${pageNum}&pageSize=${pageSize}`,
    method: 'get'
  })
}


// 实时运行
//储能
export function storagePower(siteId) {
  return request({
    url: `/ems/siteMonitor/runningGraph/storagePower?siteId=${siteId}`,
    method: 'get'
  })
}
//poc平均温度
export function stackAveTemp(siteId) {
  return request({
    url: `/ems/siteMonitor/runningGraph/stackAveTemp?siteId=${siteId}`,
    method: 'get'
  })
}
// 电池平均soc
export function batteryAveSoc(siteId) {
  return request({
    url: `/ems/siteMonitor/runningGraph/batteryAveSoc?siteId=${siteId}`,
    method: 'get'
  })
}
// 电池平均温度
export function batteryAveTemp(siteId) {
  return request({
    url: `/ems/siteMonitor/runningGraph/batteryAveTemp?siteId=${siteId}`,
    method: 'get'
  })
}
// 功率曲线
export function getPowerData({siteId,deviceId,startDate,endDate,dataType}) {
  return request({
    url: `/ems/statsReport/getPowerData?siteId=${siteId}&deviceId=${deviceId}&startDate=${startDate}&endDate=${endDate}&dataType=${dataType}`,
    method: 'get'
  })
}

//电表列表
export function getLoadNameList(siteId) {
  return request({
    url: `/ems/statsReport/getLoadNameList?siteId=${siteId}`,
    method: 'get'
  })
}
// 电表报表
export function getAmmeterData({siteId,deviceId,dateTime}) {
  return request({
    url: `/ems/statsReport/getAmmeterData?siteId=${siteId}&deviceId=${deviceId}&dateTime=${dateTime}`,
    method: 'get'
  })
}


//策略列表
export function strategyRunningList(siteId) {
  return request({
    url: `/system/strategyRunning/list?siteId=${siteId}`,
    method: 'get'
  })
}
//停止策略
export function stopStrategyRunning(id) {
  return request({
    url: `/system/strategyRunning/stop?id=${id}`,
    method: 'get'
  })
}
// 获取所有主策略
export function getMainStrategyList() {
  return request({
    url: `/system/strategyRunning/getMainStrategyList`,
    method: 'get'
  })
}
//获取所有辅助策略
export function getAuxStrategyList() {
  return request({
    url: `/system/strategyRunning/getAuxStrategyList`,
    method: 'get'
  })
}
//配置策略
export function configStrategy(data) {
  return request({
    url: `/system/strategyRunning/configStrategy`,
    method: 'post',
    data
  })
}

//http://localhost:8089/strategy/temp/getTempNameList?strategyId=1&siteId=021_FXX_01
//获取策略下的所有模板列表
export function getTempNameList({siteId,strategyId}) {
  return request({
    url: `/strategy/temp/getTempNameList?siteId=${siteId}&strategyId=${strategyId}`,
    method: 'get',
  })
}
//获取模板详情
///strategy/temp/list?templateId=1
export function getStrategyTempDetail(templateId) {
  return request({
    url: `/strategy/temp/list?templateId=${templateId}`,
    method: 'get',
  })
}
//新增模板
export function addStrategyTemp(data) {
  return request({
    url: `/strategy/temp`,
    method: 'post',
    data
  })
}
export function editStrategyTemp(data) {
  return request({
    url: `/strategy/temp`,
    method: 'put',
    data
  })
}
//http://localhost:8089/strategy/temp/{id}
export function deleteStrategyTemp(id) {
  return request({
    url: `/strategy/temp/`+id,
    method: 'delete',
  })
}

//http://localhost:8089/strategy/timeConfig/list?strategyId=1&siteId=021_FXX_01
export function timeConfigList({siteId,strategyId}) {
  return request({
    url: `/strategy/timeConfig/list?siteId=${siteId}&strategyId=${strategyId}`,
    method: 'get',
  })
}
//保存时间配置
// http://localhost:8089/strategy/timeConfig
export function setTimeConfigList(data) {
  return request({
    url: `/strategy/timeConfig`,
    method: 'post',
    data
  })
}
// 策略曲线图
//http://localhost:8089/strategy/curve/curveList?strategyId=1&siteId=021_FXX_01
export function curveList({siteId,strategyId}) {
  return request({
    url: `/strategy/curve/curveList?siteId=${siteId}&strategyId=${strategyId}`,
    method: 'get',
  })
}
