Skip to main content

domain/
message.rs

1//! Customer and staff message delivery state.
2//!
3//! Message values distinguish drafts, approvals, queued sends, delivery evidence, and suppression
4//! reasons so automation can assist high-volume pet-parent communication without sending outside the
5//! configured channel, consent, and manager-review boundaries.
6
7use nutype::nutype;
8#[allow(unused_imports)]
9use serde::{Deserialize, Serialize};
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
12/// Direction of a message relative to the resort operation: inbound, outbound draft, queued, or sent.
13pub enum Direction {
14    /// Inbound received message direction, channel, approval state, or delivery state.
15    InboundReceived,
16    /// Outbound draft message direction, channel, approval state, or delivery state.
17    OutboundDraft,
18    /// Outbound queued message direction, channel, approval state, or delivery state.
19    OutboundQueued,
20    /// Outbound sent message direction, channel, approval state, or delivery state.
21    OutboundSent,
22}
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
25/// Message channel used for customer, staff, portal, phone-note, or internal communication.
26pub enum Channel {
27    /// Email message direction, channel, approval state, or delivery state.
28    Email,
29    /// Sms message direction, channel, approval state, or delivery state.
30    Sms,
31    /// Phone note message direction, channel, approval state, or delivery state.
32    PhoneNote,
33    /// Portal message direction, channel, approval state, or delivery state.
34    Portal,
35    /// Internal message direction, channel, approval state, or delivery state.
36    Internal,
37}
38
39#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
40/// Normalized lifecycle states used to reconcile source-system data with domain workflows.
41pub enum Status {
42    /// Draft created message direction, channel, approval state, or delivery state.
43    DraftCreated,
44    /// Approval requested message direction, channel, approval state, or delivery state.
45    ApprovalRequested,
46    /// Approved to queue message direction, channel, approval state, or delivery state.
47    ApprovedToQueue,
48    /// Queued message direction, channel, approval state, or delivery state.
49    Queued,
50    /// Send attempted message direction, channel, approval state, or delivery state.
51    SendAttempted,
52    /// Delivered message direction, channel, approval state, or delivery state.
53    Delivered,
54    /// Deposit collection was attempted but did not succeed.
55    Failed,
56    /// Suppressed message direction, channel, approval state, or delivery state.
57    Suppressed,
58    /// Reservation is no longer active.
59    Cancelled,
60}
61
62#[nutype(
63    sanitize(trim),
64    validate(not_empty, len_char_max = 500),
65    derive(
66        Debug,
67        Clone,
68        PartialEq,
69        Eq,
70        PartialOrd,
71        Ord,
72        Hash,
73        Serialize,
74        Deserialize
75    )
76)]
77pub struct BodyRef(String);