import { requestClient } from '#/api/request';

export namespace DecisionForecastApi {
  export interface ForecastItem {
    id: number;
    forecastCode: string;
    forecastName: string;
    pointTime: string;
    forecastValue: number;
    actualValue?: number;
    lowerBound?: number;
    upperBound?: number;
    confidenceLevel?: number;
    modelVersion?: string;
    dimension?: string;
    dimensionValue?: string;
  }
}

export function getForecastList(forecastCode: string, params?: Record<string, unknown>) {
  return requestClient.get<DecisionForecastApi.ForecastItem[]>('/bi/decision/forecast/list', {
    params: { forecastCode, ...params },
  });
}

export function generateForecast(forecastCode: string) {
  return requestClient.post('/bi/decision/forecast/generate', null, {
    params: { forecastCode },
  });
}