import type { EnergyDataPoint } from '../../index'; import { DataValidationService } from "../data/DataValidationService"; import { EventBus } from "../../core/events/EventBus"; import { Logger } from "../../utils/Logger"; /** * Data Service * * Core data access and management service providing validated, sorted energy data * with comprehensive query capabilities. Handles input validation, data sorting, * year-based navigation, and statistical analysis. * * Provides validated, indexed access to energy flow data with comprehensive * query capabilities and statistical analysis. Maintains data integrity * through immutable structures and validation at construction time. * * Key Responsibilities: * - Input validation and data structure verification * - Chronological data sorting and indexing * - Year-based data retrieval and navigation * - Fuel and sector totals calculation * - Milestone data management * - Dataset statistics and metadata * * Data Structure: * Manages EnergyDataPoint arrays with comprehensive energy flow data * including all major fuel types (solar, nuclear, hydro, wind, etc.) * and consumption sectors (electricity, residential, industrial, etc.) * * Performance Features: * - Immutable data structures for safety * - Pre-computed indices for fast lookups * - Efficient year-based navigation * - Cached statistics calculations * */ export declare class DataService { private validationService; private eventBus; private logger; readonly data: readonly EnergyDataPoint[]; readonly years: readonly number[]; readonly yearsLength: number; readonly firstYear: number; readonly lastYear: number; constructor(energyData: EnergyDataPoint[], validationService: DataValidationService, eventBus: EventBus, logger: Logger); /** * Get data for specific year * @param year - Target year to retrieve * @returns Energy data for the specified year, or undefined if not found */ getYearData(year: number): EnergyDataPoint | undefined; /** * Get index of year in chronological sequence * @param year - Year to locate * @returns Zero-based index of year, or -1 if not found */ getYearIndex(year: number): number; /** * Check if year exists in dataset * @param year - Year to check * @returns True if year has data available */ hasYear(year: number): boolean; /** * Get data by chronological index * @param index - Zero-based index in sorted data array * @returns Energy data at specified index, or undefined if out of bounds */ getYearDataByIndex(index: number): EnergyDataPoint | undefined; /** * Check if year is valid and within dataset range * @param year - Year to validate * @returns True if year exists and is within valid range */ isValidYear(year: number): boolean; /** * Get year range as tuple * @returns Tuple containing [firstYear, lastYear] */ getYearRange(): [number, number]; /** * Get total number of data points * @returns Count of available years in dataset */ getDataCount(): number; /** * Get chronologically next year * @param currentYear - Starting year * @returns Next available year, or null if at end of dataset */ getNextYear(currentYear: number): number | null; /** * Get chronologically previous year * @param currentYear - Starting year * @returns Previous available year, or null if at beginning of dataset */ getPreviousYear(currentYear: number): number | null; /** * Get energy total for specific year, fuel, and sector combination * @param year - Target year * @param fuel - Fuel type (e.g., 'coal', 'gas', 'solar') * @param sector - Consumption sector (e.g., 'elec', 'trans', 'indus') * @returns Energy value for the specified combination */ getTotalForYear(year: number, fuel: string, sector: string): number; /** * Get total energy consumption for specific fuel across all sectors * * **Energy Industry Analysis Method:** * - Aggregates fuel consumption across all end-use sectors * - Provides fuel-specific energy totals for analysis and visualization * - Follows EIA energy accounting standards for sector summation * * @param year - Target year * @param fuel - Fuel type to sum (e.g., 'coal', 'gas', 'solar') * @returns Total energy consumption for fuel across all sectors */ getYearTotalForFuel(year: number, fuel: string): number; /** * Get total energy consumption for specific sector across all fuels * * **Sectoral Energy Analysis Method:** * - Aggregates energy consumption by end-use sector across all fuel types * - Handles electricity as both source and consumption (special case logic) * - Provides sectoral energy totals for economic and policy analysis * * @param year - Target year * @param sector - Sector to sum (e.g., 'trans' for transportation) * @returns Total energy consumption for sector across all fuel types */ getYearTotalForSector(year: number, sector: string): number; /** * Get historical milestone description for specific year * @param year - Target year * @returns Milestone description string, or undefined if no milestone */ getMilestoneForYear(year: number): string | undefined; /** * Get array of all years containing historical milestones * @returns Array of years with milestone data available */ getYearsWithMilestones(): number[]; /** * Get list of all fuel types available in dataset * @returns Array of fuel type names (e.g., ['solar', 'coal', 'gas']) */ getAvailableFuels(): string[]; /** * Get list of all consumption sectors available in dataset * @returns Array of sector names (e.g., ['elec', 'trans', 'indus']) */ getAvailableSectors(): string[]; /** * Get comprehensive statistics about the dataset * Provides metadata useful for analysis, debugging, and performance monitoring * @returns Object containing dataset statistics and metadata */ getDataStatistics(): { totalDataPoints: number; yearRange: [number, number]; averageYearGap: number; milestonesCount: number; fuelsCount: number; sectorsCount: number; }; } //# sourceMappingURL=DataService.d.ts.map