///|
pub(all) enum SimulationEventType {
  EventRequestRoute
  EventCancelRoute
  EventThrowSwitch
  EventOccupyTrack
  EventClearTrack
  EventInjectFault
  EventClearFault
  EventTrainStep
} derive(Eq, Debug)

///|
pub(all) struct SimulationEvent {
  event_id : Int64
  event_type : SimulationEventType
  route_id : @interlocking.RouteId?
  track_id : @topology.TrackId?
  turnout_id : @topology.TurnoutId?
  target_position : @topology.TurnoutPosition?
  train_id : String
  timestamp_ms : Int64
} derive(Debug)

///|
pub fn SimulationEvent::empty() -> SimulationEvent {
  {
    event_id: 0,
    event_type: EventTrainStep,
    route_id: None,
    track_id: None,
    turnout_id: None,
    target_position: None,
    train_id: "",
    timestamp_ms: 0,
  }
}

///|
pub(all) struct CycleReport {
  cycle_count : Int64
  events_processed : Int
  routes_active : Int
  safety_violations : Int
  active_slots_scanned : Int
  sections_released : Int
  switches_released : Int
  emergency_actions : Int
  execution_micro_seconds : Int64
} derive(Debug)

///|
pub fn CycleReport::new() -> CycleReport {
  {
    cycle_count: 0,
    events_processed: 0,
    routes_active: 0,
    safety_violations: 0,
    active_slots_scanned: 0,
    sections_released: 0,
    switches_released: 0,
    emergency_actions: 0,
    execution_micro_seconds: 0,
  }
}