//! Resolved config types.

use std::collections::BTreeMap;

use shakrs_json_parser::Waiver;

/// The active configuration after resolving enablement against the registry.
#[derive(Debug, Clone)]
pub(crate) struct ResolvedConfig {
    /// Enabled policies keyed by id, each with its params.
    pub(crate) enabled: BTreeMap<String, serde_json::Value>,
    /// The waivers to apply after reconcile.
    pub(crate) waivers: Vec<Waiver>,
}

/// Why loading or resolving the config failed.
#[derive(Debug, Clone)]
#[expect(
    clippy::module_name_repetitions,
    reason = "ConfigError is the config-loading contract's error; the name reads at call sites and is not about the module."
)]
pub enum ConfigError {
    /// `shakrs.json` is absent at the workspace root.
    Missing,
    /// `shakrs.json` could not be read.
    Io(String),
    /// `shakrs.json` failed to parse or violated its schema/semantics.
    Parse(String),
    /// An override names a policy id that is not registered.
    UnknownPolicy(String),
}
