Skip to main content

storage/service_line/
boarding.rs

1//! Boarding storage projection codes for accommodation, included care, and add-ons.
2//!
3//! These codes are durable serialization values for boarding service rules;
4//! the domain layer owns the meaning of suites, Pawgress Reports, medication
5//! support, and cross-sell add-ons.
6
7use serde::{Deserialize, Serialize};
8
9use domain::operations::lodging_offer;
10/// Storage shape for a migrated boarding service rules.
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12#[serde(transparent)]
13pub struct ContractRecord(pub domain::boarding::Contract);
14
15impl From<domain::boarding::Contract> for ContractRecord {
16    fn from(value: domain::boarding::Contract) -> Self {
17        Self(value)
18    }
19}
20
21impl From<ContractRecord> for domain::boarding::Contract {
22    fn from(record: ContractRecord) -> Self {
23        record.0
24    }
25}
26
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
28#[serde(rename_all = "snake_case")]
29/// Storage-facing boarding accommodation code.
30pub enum AccommodationCode {
31    /// Stable storage code for classic suite.
32    ClassicSuite,
33    /// Stable storage code for luxury suite.
34    LuxurySuite,
35    /// Stable storage code for cat condo.
36    CatCondo,
37}
38
39#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
40#[serde(rename_all = "snake_case")]
41/// Storage-facing boarding included-care feature code.
42pub enum CareFeatureCode {
43    /// Stable storage code for daily housekeeping.
44    DailyHousekeeping,
45    /// Stable storage code for potty walks.
46    PottyWalks,
47    /// Stable storage code for bedding.
48    Bedding,
49    /// Stable storage code for pawgress report.
50    PawgressReport,
51    /// Stable storage code for feeding support.
52    FeedingSupport,
53    /// Stable storage code for medication support.
54    MedicationSupport,
55}
56
57#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
58#[serde(rename_all = "snake_case")]
59/// Storage-facing boarding add-on code.
60pub enum AddOnCode {
61    /// Stable storage code for playtime.
62    Playtime,
63    /// Stable storage code for exit bath.
64    ExitBath,
65    /// Stable storage code for premium suite.
66    PremiumSuite,
67    /// Stable storage code for grooming.
68    Grooming,
69    /// Stable storage code for training session.
70    TrainingSession,
71}
72
73impl From<AccommodationCode> for lodging_offer::Accommodation {
74    fn from(value: AccommodationCode) -> Self {
75        match value {
76            AccommodationCode::ClassicSuite => Self::ClassicSuite,
77            AccommodationCode::LuxurySuite => Self::LuxurySuite,
78            AccommodationCode::CatCondo => Self::CatCondo,
79        }
80    }
81}
82
83impl From<lodging_offer::Accommodation> for AccommodationCode {
84    fn from(value: lodging_offer::Accommodation) -> Self {
85        match value {
86            lodging_offer::Accommodation::ClassicSuite => Self::ClassicSuite,
87            lodging_offer::Accommodation::LuxurySuite => Self::LuxurySuite,
88            lodging_offer::Accommodation::CatCondo => Self::CatCondo,
89        }
90    }
91}
92
93impl From<CareFeatureCode> for lodging_offer::CareFeature {
94    fn from(value: CareFeatureCode) -> Self {
95        match value {
96            CareFeatureCode::DailyHousekeeping => Self::DailyHousekeeping,
97            CareFeatureCode::PottyWalks => Self::PottyWalks,
98            CareFeatureCode::Bedding => Self::Bedding,
99            CareFeatureCode::PawgressReport => Self::PawgressReport,
100            CareFeatureCode::FeedingSupport => Self::FeedingSupport,
101            CareFeatureCode::MedicationSupport => Self::MedicationSupport,
102        }
103    }
104}
105
106impl From<lodging_offer::CareFeature> for CareFeatureCode {
107    fn from(value: lodging_offer::CareFeature) -> Self {
108        match value {
109            lodging_offer::CareFeature::DailyHousekeeping => Self::DailyHousekeeping,
110            lodging_offer::CareFeature::PottyWalks => Self::PottyWalks,
111            lodging_offer::CareFeature::Bedding => Self::Bedding,
112            lodging_offer::CareFeature::PawgressReport => Self::PawgressReport,
113            lodging_offer::CareFeature::FeedingSupport => Self::FeedingSupport,
114            lodging_offer::CareFeature::MedicationSupport => Self::MedicationSupport,
115        }
116    }
117}
118
119impl From<AddOnCode> for lodging_offer::AddOn {
120    fn from(value: AddOnCode) -> Self {
121        match value {
122            AddOnCode::Playtime => Self::Playtime,
123            AddOnCode::ExitBath => Self::ExitBath,
124            AddOnCode::PremiumSuite => Self::PremiumSuite,
125            AddOnCode::Grooming => Self::Grooming,
126            AddOnCode::TrainingSession => Self::TrainingSession,
127        }
128    }
129}
130
131impl From<lodging_offer::AddOn> for AddOnCode {
132    fn from(value: lodging_offer::AddOn) -> Self {
133        match value {
134            lodging_offer::AddOn::Playtime => Self::Playtime,
135            lodging_offer::AddOn::ExitBath => Self::ExitBath,
136            lodging_offer::AddOn::PremiumSuite => Self::PremiumSuite,
137            lodging_offer::AddOn::Grooming => Self::Grooming,
138            lodging_offer::AddOn::TrainingSession => Self::TrainingSession,
139        }
140    }
141}