//! Broker data types.

use std::path::PathBuf;

use aqc_file_engine_core::Finding;

/// One engine's reconcile result, tagged with the file it owns.
#[derive(Debug)]
pub(crate) struct ReconciledFile {
    /// The file the engine owns.
    pub(crate) path: PathBuf,
    /// The bytes `init` would write.
    pub(crate) expected_bytes: Vec<u8>,
    /// The findings the reconcile produced.
    pub(crate) findings: Vec<Finding>,
}

/// Why a broker operation aborted.
#[derive(Debug, Clone)]
pub(crate) enum BrokerError {
    /// An engine id had requirements routed to it but is not registered.
    UnknownEngine(String),
    /// Reading the file an engine owns failed.
    Read {
        /// The file that could not be read.
        path: String,
        /// The underlying I/O error message.
        detail: String,
    },
}
