use crate::semantics::semantics::Semantics;
use ebi_objects::{
    Activity, BusinessProcessModelAndNotation, anyhow::Result, ebi_bpmn::BPMNMarking,
    ebi_objects::labelled_petri_net::TransitionIndex,
};

impl Semantics for BusinessProcessModelAndNotation {
    type SemState = BPMNMarking;

    fn get_initial_state(&self) -> Option<<Self as Semantics>::SemState> {
        self.get_initial_marking().unwrap()
    }

    fn execute_transition(
        &self,
        state: &mut <Self as Semantics>::SemState,
        transition: TransitionIndex,
    ) -> Result<()> {
        BusinessProcessModelAndNotation::execute_transition(&self, state, transition)
    }

    fn is_final_state(&self, state: &<Self as Semantics>::SemState) -> bool {
        self.is_final_marking(state).unwrap()
    }

    fn is_transition_silent(
        &self,
        transition: TransitionIndex,
        state: &<Self as Semantics>::SemState,
    ) -> bool {
        BusinessProcessModelAndNotation::is_transition_silent(&self, transition, state)
    }

    fn get_transition_activity(
        &self,
        transition: TransitionIndex,
        state: &<Self as Semantics>::SemState,
    ) -> Option<Activity> {
        BusinessProcessModelAndNotation::get_transition_activity(&self, transition, state)
    }

    fn get_enabled_transitions(
        &self,
        state: &<Self as Semantics>::SemState,
    ) -> Vec<TransitionIndex> {
        BusinessProcessModelAndNotation::get_enabled_transitions(&self, state).unwrap()
    }

}
