use std::time::Duration;

/// Events emitted during dataset registration and query execution.
#[derive(Debug, Clone)]
pub enum ProgressEvent {
    /// Array discovery phase — reports how many arrays found so far.
    DiscoveringArrays { found: usize },
    /// Reading coordinate variable values (chunk-by-chunk).
    ReadingCoordinate {
        dim_name: String,
        chunk: usize,
        total: usize,
    },
    /// A lazily-registered dataset is being loaded on first access.
    LoadingDataset { name: String },
    /// Dataset registration completed successfully.
    DatasetRegistered {
        name: String,
        data_vars: usize,
        coords: usize,
    },
    /// Scan progress — reports current chunk position out of total.
    ScanProgress { chunk: usize, total: usize },
    /// Query execution completed.
    QueryComplete {
        total_chunks: usize,
        total_cells: u64,
        elapsed: Duration,
    },
}

/// Trait for receiving progress updates during long-running operations.
pub trait ProgressReporter: Send + Sync {
    fn report(&self, event: &ProgressEvent);
}

/// No-op reporter — used when progress reporting is not needed.
pub struct NullReporter;

impl ProgressReporter for NullReporter {
    fn report(&self, _: &ProgressEvent) {}
}
