mod catalogs;
mod context;
mod entities;
mod events;
mod metadata;
mod runtime_variables;
mod service_state;

use crate::state::RuntimeState;
use context::ValidationContext;

impl RuntimeState {
    pub fn validate(&self) -> Result<(), String> {
        self.calendar.validate()?;

        let mut context = ValidationContext::default();
        entities::validate_entities(self, &mut context)?;
        catalogs::validate_catalogs(self, &mut context)?;
        events::validate_events(self, &context)?;
        metadata::validate_metadata(self)?;
        runtime_variables::validate_runtime_variables(self, &context)?;
        service_state::validate_service_state(self, &context)?;

        Ok(())
    }
}
