use std::sync::{Mutex, Arc};
use crate::prelude::*;
use super::execution_context_core::ExecutionContextCore;
pub trait ExecutionContext : Send + Sync {
fn name(&self) -> &str;
fn type_name(&self) -> &str;
fn on_starting(&mut self, _core: &Arc<Mutex<ExecutionContextCore>>) -> JuizResult<()> {
Ok(())
}
fn on_stopping(&mut self, _core: &Arc<Mutex<ExecutionContextCore>>) -> JuizResult<()> {
Ok(())
}
fn profile(&self) -> JuizResult<Value>;
fn execute(&self, core: &Arc<Mutex<ExecutionContextCore>>) -> JuizResult<bool>;
fn on_load(&mut self, _system: &mut System, _core: Arc<Mutex<ExecutionContextCore>>) -> () {
}
fn is_periodic(&self) -> bool {
return true;
}
}