// src/server/reports/types.ts

export type AverageMetrics = {
  avg_sap: number | null;
  avg_carbon: number | null;
  avg_bills: number | null;
  avg_energy_consumption: number | null;
};

export type TotalMetrics = {
  total_carbon: number | null;
  total_bills: number | null;
};

export type AgeBandCount = {
  age_band: string;
  count: number;
};

export type EpcBandCount = {
  epc: string;
  actual: number;
  estimated: number;
};

export type EstimatedCounts = {
  estimated: number;
  actual: number;
};

export type PropertyTypeCount = {
  type: string | null;
  count: number;
};

export interface BaselineMetrics {
  total: number;
  averages: AverageMetrics;
  totals: TotalMetrics;
  ageBands: AgeBandCount[];
  epcBands: EpcBandCount[];
  estimatedCounts: EstimatedCounts;
  expiredEpcs: number;
  likelyDowngrades: number;
}

export type MetricKey =
  | "totalHomes"
  | "avgSap"
  | "avgCarbon"
  | "avgBills"
  | "missingEpc";

export interface ScenarioSummary {
  id: number;
  name: string;
}

export interface ScenarioOverlayMetrics {
  avgSap?: {
    baseline: number;
    scenario: number;
  };

  avgCarbon?: {
    baseline: number;
    scenario: number;
    baselineTotal: number;
    scenarioTotal: number;
  };

  avgBills?: {
    baseline: number;
    scenario: number;
    baselineTotal: number;
    scenarioTotal: number;
  };

  valuation?: {
    baseline: number | null;
    scenario: number | null;
  };
}
