use crate::entity::EntityId;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccessControl {
allowed_stops: HashSet<EntityId>,
}
impl AccessControl {
#[must_use]
pub const fn new(allowed_stops: HashSet<EntityId>) -> Self {
Self { allowed_stops }
}
#[must_use]
pub fn can_access(&self, stop: EntityId) -> bool {
self.allowed_stops.contains(&stop)
}
#[must_use]
pub const fn allowed_stops(&self) -> &HashSet<EntityId> {
&self.allowed_stops
}
}