//! Full Herbrand enumeration grounder.
//!
//! The simplest grounding strategy: collects all constants from the system
//! and generates every substitution of variables to constants via the
//! `GroundingContext`.

use crate::error::AspicError;
use crate::language::grounding::{GroundedSystem, GroundingContext};
use crate::pipeline::traits::Grounder;
use crate::system::AspicSystem;

/// Full Herbrand enumeration grounder.
///
/// Collects all constants from the system and generates every substitution
/// of variables to constants. Simple and complete, but may produce
/// irrelevant ground instances for systems with many constants and variables.
/// See [`SemiNaiveGrounder`](super::SemiNaiveGrounder) for a more targeted
/// alternative.
#[derive(Default)]
pub struct NaiveGrounder;

impl Grounder for NaiveGrounder {
    fn ground(&self, system: &AspicSystem) -> Result<GroundedSystem, AspicError> {
        let ctx = GroundingContext::from_system(system);
        ctx.ground_system(system)
    }
}
