import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReportPortVO, ReportPortForm, ReportPortQuery } from '@/api/ems/report/types';

// 查询能源预览接口
export function energyPreviewReportList(query) {
  return request({
    url: '/ems/report/energyPreviewReportList',
    method: 'get',
    params: query
  })
}

/**
 * 查询端口报表列表
 */
export function listReportPort(query: ReportPortQuery): AxiosPromise<ReportPortVO[]> {
  return request({
    url: '/ems/report/reportPort/list',
    method: 'get',
    params: query
  });
}

/**
 * 查询端口报表详细
 */
export function getReportPort(objId: string | number): AxiosPromise<ReportPortVO> {
  return request({
    url: '/ems/report/reportPort/' + objId,
    method: 'get'
  });
}

/**
 * 生成端口报表
 */
export function generateReportPort(data: ReportPortForm) {
  return request({
    url: '/ems/report/reportPort/generate',
    method: 'post',
    data: data
  });
}

/**
 * 导出端口报表
 */
export function exportReportPort(query: ReportPortQuery) {
  return request({
    url: '/ems/report/reportPort/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  });
}
// 查询统计能耗报表
export function energyStatisticalReportList(query) {
  return request({
    url: '/ems/report/energyStatisticalReportList',
    method: 'get',
    params: query
  })
}

// 查询峰平谷耗量报表
export function peaksValleysConsumptionReportList(query) {
  return request({
    url: '/ems/report/peaksValleysConsumptionReportList',
    method: 'get',
    params: query
  })
}
