storage/service_line/
retail.rs1use serde::{Deserialize, Serialize};
8
9use domain::retail::product;
10
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13#[serde(transparent)]
14pub struct ContractRecord(pub domain::retail::Contract);
15
16impl From<domain::retail::Contract> for ContractRecord {
17 fn from(value: domain::retail::Contract) -> Self {
18 Self(value)
19 }
20}
21
22impl From<ContractRecord> for domain::retail::Contract {
23 fn from(record: ContractRecord) -> Self {
24 record.0
25 }
26}
27
28#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
29#[serde(rename_all = "snake_case")]
30pub enum PartnerCode {
32 VirbacCalmCare,
34 PurinaProPlanVeterinarySupplements,
36 PurinaEnBoardingDiet,
38}
39
40#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
41#[serde(rename_all = "snake_case")]
42pub enum ProductCategoryCode {
44 Supplement,
46 InHouseDiet,
48 PersonalizedUpsell,
50}
51
52impl From<PartnerCode> for domain::retail::Partner {
53 fn from(value: PartnerCode) -> Self {
54 match value {
55 PartnerCode::VirbacCalmCare => Self::VirbacCalmCare,
56 PartnerCode::PurinaProPlanVeterinarySupplements => {
57 Self::PurinaProPlanVeterinarySupplements
58 }
59 PartnerCode::PurinaEnBoardingDiet => Self::PurinaEnBoardingDiet,
60 }
61 }
62}
63
64impl From<domain::retail::Partner> for PartnerCode {
65 fn from(value: domain::retail::Partner) -> Self {
66 match value {
67 domain::retail::Partner::VirbacCalmCare => Self::VirbacCalmCare,
68 domain::retail::Partner::PurinaProPlanVeterinarySupplements => {
69 Self::PurinaProPlanVeterinarySupplements
70 }
71 domain::retail::Partner::PurinaEnBoardingDiet => Self::PurinaEnBoardingDiet,
72 }
73 }
74}
75
76impl From<ProductCategoryCode> for product::Category {
77 fn from(value: ProductCategoryCode) -> Self {
78 match value {
79 ProductCategoryCode::Supplement => Self::Supplement,
80 ProductCategoryCode::InHouseDiet => Self::InHouseDiet,
81 ProductCategoryCode::PersonalizedUpsell => Self::PersonalizedUpsell,
82 }
83 }
84}
85
86impl From<product::Category> for ProductCategoryCode {
87 fn from(value: product::Category) -> Self {
88 match value {
89 product::Category::Supplement => Self::Supplement,
90 product::Category::InHouseDiet => Self::InHouseDiet,
91 product::Category::PersonalizedUpsell => Self::PersonalizedUpsell,
92 }
93 }
94}