use serde::{Deserialize, Serialize};
use crate::entity::EntityId;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct CarCall {
pub car: EntityId,
pub floor: EntityId,
pub press_tick: u64,
pub acknowledged_at: Option<u64>,
pub ack_latency_ticks: u32,
pub pending_riders: Vec<EntityId>,
}
impl CarCall {
#[must_use]
pub const fn new(car: EntityId, floor: EntityId, press_tick: u64) -> Self {
Self {
car,
floor,
press_tick,
acknowledged_at: None,
ack_latency_ticks: 0,
pending_riders: Vec::new(),
}
}
#[must_use]
pub const fn is_acknowledged(&self) -> bool {
self.acknowledged_at.is_some()
}
}