Skip to main content

storage/service_line/
daycare.rs

1//! Daycare storage projection codes for play formats and eligibility rules.
2//!
3//! These records preserve source/catalog choices such as all-day play,
4//! day-boarding, and staff-to-pet-ratio checks. Domain workflows decide whether
5//! a pet is eligible and whether a manager review is required.
6
7use serde::{Deserialize, Serialize};
8
9/// Storage shape for a migrated daycare service rules.
10#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
11#[serde(transparent)]
12pub struct ContractRecord(pub domain::daycare::Contract);
13
14impl From<domain::daycare::Contract> for ContractRecord {
15    fn from(value: domain::daycare::Contract) -> Self {
16        Self(value)
17    }
18}
19
20impl From<ContractRecord> for domain::daycare::Contract {
21    fn from(record: ContractRecord) -> Self {
22        record.0
23    }
24}
25
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
27#[serde(rename_all = "snake_case")]
28/// Storage-facing daycare format code used by service-offering records.
29pub enum FormatCode {
30    /// Stable storage code for all day play.
31    AllDayPlay,
32    /// Stable storage code for half day play.
33    HalfDayPlay,
34    /// Stable storage code for day boarding.
35    DayBoarding,
36    /// Stable storage code for day play plus room.
37    DayPlayPlusRoom,
38    /// Stable storage code for cat individual playtime.
39    CatIndividualPlaytime,
40}
41
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "snake_case")]
44/// Storage-facing daycare eligibility rule code.
45pub enum EligibilityRuleCode {
46    /// Stable storage code for temperament review required.
47    TemperamentReviewRequired,
48    /// Stable storage code for spay neuter required for group play.
49    SpayNeuterRequiredForGroupPlay,
50    /// Stable storage code for vaccine proof required.
51    VaccineProofRequired,
52    /// Stable storage code for staff to pet ratio required.
53    StaffToPetRatioRequired,
54}
55
56impl From<FormatCode> for domain::operations::DaycareFormat {
57    fn from(value: FormatCode) -> Self {
58        match value {
59            FormatCode::AllDayPlay => Self::AllDayPlay,
60            FormatCode::HalfDayPlay => Self::HalfDayPlay,
61            FormatCode::DayBoarding => Self::DayBoarding,
62            FormatCode::DayPlayPlusRoom => Self::DayPlayPlusRoom,
63            FormatCode::CatIndividualPlaytime => Self::CatIndividualPlaytime,
64        }
65    }
66}
67
68impl From<domain::operations::DaycareFormat> for FormatCode {
69    fn from(value: domain::operations::DaycareFormat) -> Self {
70        match value {
71            domain::operations::DaycareFormat::AllDayPlay => Self::AllDayPlay,
72            domain::operations::DaycareFormat::HalfDayPlay => Self::HalfDayPlay,
73            domain::operations::DaycareFormat::DayBoarding => Self::DayBoarding,
74            domain::operations::DaycareFormat::DayPlayPlusRoom => Self::DayPlayPlusRoom,
75            domain::operations::DaycareFormat::CatIndividualPlaytime => Self::CatIndividualPlaytime,
76        }
77    }
78}
79
80impl From<EligibilityRuleCode> for domain::operations::DaycareEligibilityRule {
81    fn from(value: EligibilityRuleCode) -> Self {
82        match value {
83            EligibilityRuleCode::TemperamentReviewRequired => Self::TemperamentReviewRequired,
84            EligibilityRuleCode::SpayNeuterRequiredForGroupPlay => {
85                Self::SpayNeuterRequiredForGroupPlay
86            }
87            EligibilityRuleCode::VaccineProofRequired => Self::VaccineProofRequired,
88            EligibilityRuleCode::StaffToPetRatioRequired => Self::StaffToPetRatioRequired,
89        }
90    }
91}
92
93impl From<domain::operations::DaycareEligibilityRule> for EligibilityRuleCode {
94    fn from(value: domain::operations::DaycareEligibilityRule) -> Self {
95        match value {
96            domain::operations::DaycareEligibilityRule::TemperamentReviewRequired => {
97                Self::TemperamentReviewRequired
98            }
99            domain::operations::DaycareEligibilityRule::SpayNeuterRequiredForGroupPlay => {
100                Self::SpayNeuterRequiredForGroupPlay
101            }
102            domain::operations::DaycareEligibilityRule::VaccineProofRequired => {
103                Self::VaccineProofRequired
104            }
105            domain::operations::DaycareEligibilityRule::StaffToPetRatioRequired => {
106                Self::StaffToPetRatioRequired
107            }
108        }
109    }
110}