use crate::engine::effects::{AppliedEffectsSummary, EventGraphMutation};
use crate::event::records::RuntimeEventRecordTemplate;

pub(super) fn apply_append_event_record(
    summary: &mut AppliedEffectsSummary,
    staged_event_graph_mutations: &mut Vec<EventGraphMutation>,
    record: &std::boxed::Box<RuntimeEventRecordTemplate>,
) {
    staged_event_graph_mutations.push(EventGraphMutation::Append((**record).clone()));
    summary.appended_record_ids.push(record.record_id);
}

pub(super) fn apply_activate_event_record(
    summary: &mut AppliedEffectsSummary,
    staged_event_graph_mutations: &mut Vec<EventGraphMutation>,
    record_id: u32,
) {
    staged_event_graph_mutations.push(EventGraphMutation::Activate { record_id });
    summary.activated_record_ids.push(record_id);
}

pub(super) fn apply_deactivate_event_record(
    summary: &mut AppliedEffectsSummary,
    staged_event_graph_mutations: &mut Vec<EventGraphMutation>,
    record_id: u32,
) {
    staged_event_graph_mutations.push(EventGraphMutation::Deactivate { record_id });
    summary.deactivated_record_ids.push(record_id);
}

pub(super) fn apply_remove_event_record(
    summary: &mut AppliedEffectsSummary,
    staged_event_graph_mutations: &mut Vec<EventGraphMutation>,
    record_id: u32,
) {
    staged_event_graph_mutations.push(EventGraphMutation::Remove { record_id });
    summary.removed_record_ids.push(record_id);
}
