domain/boarding/accommodation.rs
1//! Boarding accommodation vocabulary for suite/condo matching and species-safe capacity decisions.
2//!
3//! These contracts keep room-type preferences explicit so automation can recommend availability
4//! without inventing unsupported species accommodations or collapsing premium-suite choices.
5
6use super::*;
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9/// Accommodation kinds used when matching a boarding request to room or suite inventory.
10pub enum Kind {
11 /// Standard dog boarding suite option used for baseline dog-room capacity.
12 ClassicDogSuite,
13 /// Premium dog boarding suite option used for capacity matching and upgrade offers.
14 LuxuryDogSuite,
15 /// Cat lodging option that must not be matched to dog boarding requests.
16 CatCondo,
17}
18
19impl Kind {
20 /// Reports whether this accommodation can safely serve the requested pet species.
21 pub const fn supports_species(self, species: &crate::entities::Species) -> bool {
22 matches!(
23 (self, species),
24 (
25 Self::ClassicDogSuite | Self::LuxuryDogSuite,
26 crate::entities::Species::Dog
27 ) | (Self::CatCondo, crate::entities::Species::Cat)
28 )
29 }
30}
31
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
33/// Guest or staff accommodation preference supplied to a boarding capacity check.
34pub enum Preference {
35 /// A single requested room type that should be evaluated before alternatives.
36 Specific(Kind),
37 /// A bounded list of acceptable room types when the guest can accept alternatives.
38 AnyOf(Vec<Kind>),
39}
40
41impl Preference {
42 /// Exposes the acceptable accommodation kinds in evaluation order for capacity policy.
43 pub fn acceptable_kinds(&self) -> &[Kind] {
44 match self {
45 Self::Specific(kind) => std::slice::from_ref(kind),
46 Self::AnyOf(kinds) => kinds.as_slice(),
47 }
48 }
49}