domain/incident.rs
1//! Incident categories and review states for pet-safety workflows.
2//!
3//! ## Operator-summary
4//!
5//! This module supports the incident queue that classifies injuries, altercations, behavior
6//! issues, medication errors, escapes, property damage, and customer-service problems by
7//! severity and lifecycle. It can reduce labor by making manager follow-up, investigation,
8//! customer-message review, legal hold, daily-brief risk, and reputation-response routing
9//! visible from the same source-backed incident facts.
10//!
11//! It must not automate live customer promises, medical/legal conclusions, disciplinary
12//! action, refunds, provider writes, or closure of a safety event. Authoritative facts remain
13//! the original staff/source report, redacted summary, evidence documents, affected subjects,
14//! severity/category review, required gates, and audit history. Review gates protect pets,
15//! customers, and staff by keeping high/critical, customer-message, reopened, legal-hold,
16//! or manager-review incidents in human review before follow-up, eligibility changes, or
17//! external communication occur.
18//!
19//! Incident facts are source-derived evidence that must stay review-gated: they can create
20//! staff follow-up, manager escalation, reputation response, and daily-brief risk entries,
21//! but they should not trigger unapproved customer, legal, or medical commitments.
22
23use nutype::nutype;
24#[allow(unused_imports)]
25use serde::{Deserialize, Serialize};
26
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
28/// Incident category that routes injury, behavior, escape, property, and medication follow-up.
29pub enum Category {
30 /// Injury report involving a pet, customer, or staff member that needs evidence and care review.
31 Injury,
32 /// Altercation between pets or people that may affect eligibility, staffing, and customer communication.
33 Altercation,
34 /// Behavior event that should feed temperament, daycare, or handling review before future care decisions.
35 Behavior,
36 /// Medication error or concern requiring care review and careful customer communication.
37 Medication,
38 /// Escape or containment issue that requires safety review and operational follow-up.
39 Escape,
40 /// Property damage incident preserved for manager review, repair labor, and customer context.
41 Property,
42 /// Customer-service complaint or service failure that requires manager-reviewed follow-up.
43 CustomerService,
44 /// Non-dog, non-cat pet handled by exception policy.
45 Other,
46}
47
48#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
49/// Incident severity used to rank manager attention, customer communication, and safety review.
50pub enum Severity {
51 /// Low-severity incident that still remains visible for trend and labor follow-up.
52 Low,
53 /// Medium-severity incident requiring normal manager awareness and documentation.
54 Medium,
55 /// High-severity incident that should drive manager review and follow-up labor.
56 High,
57 /// Critical incident requiring immediate manager attention and strict communication review.
58 Critical,
59}
60
61#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
62/// Review lifecycle for incidents as they move from source report to resolution.
63pub enum Status {
64 /// Source report exists but facts, category, and communication plan are not yet reviewed.
65 Reported,
66 /// Manager must review the incident before staff close it or use it in customer messaging.
67 NeedsManagerReview,
68 /// Staff are collecting evidence; downstream actions should wait for investigation context.
69 InvestigationOpen,
70 /// Customer-facing communication is drafted or needed but must be approved before sending.
71 CustomerMessageReview,
72 /// Incident has reviewed resolution evidence, but audit history remains available for future care context.
73 Resolved,
74 /// Incident lifecycle is closed after required review and communication steps are complete.
75 Closed,
76 /// New evidence or follow-up reopened the incident and should restore manager attention.
77 Reopened,
78 /// Legal-sensitive incident must not trigger routine automation or unapproved customer commitments.
79 LegalHold,
80}
81
82#[nutype(
83 sanitize(trim),
84 validate(not_empty, len_char_max = 1000),
85 derive(
86 Debug,
87 Clone,
88 PartialEq,
89 Eq,
90 PartialOrd,
91 Ord,
92 Hash,
93 Serialize,
94 Deserialize
95 )
96)]
97/// Redacted incident summary used as evidence for review, not autonomous advice.
98pub struct Summary(String);