use crate::{State, TransitionParams};

pub trait Invariant: Send + Sync {
    fn name(&self) -> &str;
    fn check(&self, before: &State, after: &State, params: &TransitionParams) -> bool;
}

#[derive(Debug, Clone)]
pub struct InvariantResult {
    pub ok: bool,
    pub failed: Vec<String>,
}

impl InvariantResult {
    pub fn success() -> Self {
        Self { ok: true, failed: Vec::new() }
    }

    pub fn failure(failed: Vec<String>) -> Self {
        Self { ok: false, failed }
    }
}
