1use crate::gcode_index::PlannedChange;
26use crate::records::{
27 AcknowledgementDisposition, ActionId, Actor, ChargeKey, ChargeMethod, ChargedFilament,
28 ClearedMark, FilePosition, InterventionId, InterventionOutcome, LoadedSpool, PendingCharge,
29 PendingTaken, PolicyDecision, Preflight, PrintAction, PrintOutcome, RecoveryAction,
30 RecoveryRejection, SpoolCommand, SpoolId, SpoolRecord, UnverifiedReason,
31};
32use printobserver_printer_api::{Adjustable, JobSnapshot, PrinterSnapshot, PrinterState};
33use printobserver_supervisor_api::AgentAssessment;
34use printobserver_types::contract::Sample;
35use printobserver_types::schemars::JsonSchema;
36use printobserver_types::serde::{Deserialize, Serialize};
37use printobserver_types::{
38 EventId, EventKind, EventPayload, EventSource, FileName, PrintId, Timestamp,
39};
40
41pub const SYSTEM_SOURCE: &str = "system";
43
44pub const OPERATOR_SOURCE: &str = "operator";
46
47pub const AGENT_SOURCE: &str = "agent";
49
50#[must_use]
52pub fn system_source() -> EventSource {
53 EventSource::new(SYSTEM_SOURCE)
54}
55
56#[must_use]
58pub fn operator_source() -> EventSource {
59 EventSource::new(OPERATOR_SOURCE)
60}
61
62#[must_use]
64pub fn agent_source() -> EventSource {
65 EventSource::new(AGENT_SOURCE)
66}
67
68#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
70#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
71#[schemars(crate = "printobserver_types::schemars")]
72pub struct ActionRequestedPayload {
73 pub action_id: ActionId,
75 pub action: PrintAction,
77 pub actor: Actor,
79}
80
81impl EventPayload for ActionRequestedPayload {
82 const KIND: &'static str = "action_requested";
83}
84
85impl Sample for ActionRequestedPayload {
86 fn sample_full() -> Self {
87 Self {
88 action_id: ActionId::sample_full(),
89 action: PrintAction::sample_full(),
90 actor: Actor::sample_full(),
91 }
92 }
93
94 fn sample_minimal() -> Self {
95 Self {
96 action: PrintAction::sample_minimal(),
97 ..Self::sample_full()
98 }
99 }
100}
101
102#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
104#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
105#[schemars(crate = "printobserver_types::schemars")]
106pub struct ActionExecutedPayload {
107 pub action_id: ActionId,
109 #[serde(default, skip_serializing_if = "Option::is_none")]
111 pub intervention_id: Option<InterventionId>,
112 #[serde(default, skip_serializing_if = "Option::is_none")]
116 pub file_position_bytes: Option<i64>,
117}
118
119impl EventPayload for ActionExecutedPayload {
120 const KIND: &'static str = "action_executed";
121}
122
123impl Sample for ActionExecutedPayload {
124 fn sample_full() -> Self {
125 Self {
126 action_id: ActionId::sample_full(),
127 intervention_id: Some(InterventionId::sample_full()),
128 file_position_bytes: Some(4_096),
129 }
130 }
131
132 fn sample_minimal() -> Self {
133 Self {
134 action_id: ActionId::sample_full(),
135 intervention_id: None,
136 file_position_bytes: None,
137 }
138 }
139}
140
141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
143#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
144#[schemars(crate = "printobserver_types::schemars")]
145pub struct ActionRejectedPayload {
146 pub action_id: ActionId,
148 pub decision: PolicyDecision,
150}
151
152impl EventPayload for ActionRejectedPayload {
153 const KIND: &'static str = "action_rejected";
154}
155
156impl Sample for ActionRejectedPayload {
157 fn sample_full() -> Self {
158 Self {
159 action_id: ActionId::sample_full(),
160 decision: PolicyDecision::sample_full(),
161 }
162 }
163}
164
165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
167#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
168#[schemars(crate = "printobserver_types::schemars")]
169pub struct InterventionExpiredPayload {
170 pub intervention_id: InterventionId,
172 pub adjustable: Adjustable,
174 pub outcome: InterventionOutcome,
176}
177
178impl EventPayload for InterventionExpiredPayload {
179 const KIND: &'static str = "intervention_expired";
180}
181
182impl Sample for InterventionExpiredPayload {
183 fn sample_full() -> Self {
184 Self {
185 intervention_id: InterventionId::sample_full(),
186 adjustable: Adjustable::Feedrate,
187 outcome: InterventionOutcome::Restored,
188 }
189 }
190}
191
192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
194#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
195#[schemars(crate = "printobserver_types::schemars")]
196pub struct AgentAssessmentPayload {
197 pub session_name: String,
199 pub assessment: AgentAssessment,
201}
202
203impl EventPayload for AgentAssessmentPayload {
204 const KIND: &'static str = "agent_assessment";
205}
206
207impl Sample for AgentAssessmentPayload {
208 fn sample_full() -> Self {
209 Self {
210 session_name: "print-0191f0a0".to_owned(),
211 assessment: AgentAssessment::sample_full(),
212 }
213 }
214}
215
216#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
224#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
225#[schemars(crate = "printobserver_types::schemars")]
226pub struct AgentStopUnactedPayload {
227 pub event_id: EventId,
229 pub session_name: String,
231 pub summary: String,
233}
234
235impl EventPayload for AgentStopUnactedPayload {
236 const KIND: &'static str = "agent_stop_unacted";
237}
238
239impl Sample for AgentStopUnactedPayload {
240 fn sample_full() -> Self {
241 Self {
242 event_id: EventId::sample_full(),
243 session_name: "print-0191f0a0".to_owned(),
244 summary: "The part has moved off its planned place.".to_owned(),
245 }
246 }
247}
248
249#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
251#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
252#[schemars(crate = "printobserver_types::schemars")]
253pub struct OperatorAcknowledgementPayload {
254 pub acknowledged_event_id: EventId,
256 pub disposition: AcknowledgementDisposition,
258}
259
260impl EventPayload for OperatorAcknowledgementPayload {
261 const KIND: &'static str = "operator_acknowledgement";
262}
263
264impl Sample for OperatorAcknowledgementPayload {
265 fn sample_full() -> Self {
266 Self {
267 acknowledged_event_id: EventId::sample_full(),
268 disposition: AcknowledgementDisposition::Watch,
269 }
270 }
271}
272
273#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
283#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
284#[schemars(crate = "printobserver_types::schemars")]
285pub struct CameraLookPayload {
286 pub waited_s: u32,
289 #[serde(default)]
292 pub delivered: Vec<EventId>,
293 #[serde(default, skip_serializing_if = "Option::is_none")]
297 pub frame_captured_at: Option<Timestamp>,
298}
299
300impl EventPayload for CameraLookPayload {
301 const KIND: &'static str = "camera_look";
302}
303
304impl Sample for CameraLookPayload {
305 fn sample_full() -> Self {
306 Self {
307 waited_s: 60,
308 delivered: vec![EventId::sample_full()],
309 frame_captured_at: Some(Timestamp::sample_full()),
310 }
311 }
312
313 fn sample_minimal() -> Self {
314 Self {
315 waited_s: 0,
316 delivered: Vec::new(),
317 frame_captured_at: None,
318 }
319 }
320}
321
322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
332#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
333#[schemars(crate = "printobserver_types::schemars")]
334pub struct PeriodicObservationPayload {
335 pub interval_s: u64,
337 #[serde(default, skip_serializing_if = "Option::is_none")]
340 pub printer: Option<PrinterSnapshot>,
341 #[serde(default, skip_serializing_if = "Option::is_none")]
344 pub job: Option<JobSnapshot>,
345 #[serde(default, skip_serializing_if = "Option::is_none")]
348 pub frame_captured_at: Option<Timestamp>,
349}
350
351impl EventPayload for PeriodicObservationPayload {
352 const KIND: &'static str = "periodic_observation";
353}
354
355impl Sample for PeriodicObservationPayload {
356 fn sample_full() -> Self {
357 Self {
358 interval_s: 120,
359 printer: Some(PrinterSnapshot::sample_full()),
360 job: Some(JobSnapshot::sample_full()),
361 frame_captured_at: Some(Timestamp::sample_full()),
362 }
363 }
364
365 fn sample_minimal() -> Self {
366 Self {
367 interval_s: 120,
368 printer: None,
369 job: None,
370 frame_captured_at: None,
371 }
372 }
373}
374
375#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
385#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
386#[schemars(crate = "printobserver_types::schemars")]
387pub struct CameraRetryPayload {
388 pub attempt: u32,
390 pub attempts: u32,
392 pub status: u16,
394 pub excerpt: String,
396 pub backoff_ms: u64,
398}
399
400impl EventPayload for CameraRetryPayload {
401 const KIND: &'static str = "camera_retry";
402}
403
404impl Sample for CameraRetryPayload {
405 fn sample_full() -> Self {
406 Self {
407 attempt: 1,
408 attempts: 4,
409 status: 500,
410 excerpt: "exit status 69".to_owned(),
411 backoff_ms: 500,
412 }
413 }
414
415 fn sample_minimal() -> Self {
416 Self {
417 excerpt: String::new(),
418 ..Self::sample_full()
419 }
420 }
421}
422
423#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
425#[serde(
426 crate = "printobserver_types::serde",
427 rename_all = "snake_case",
428 deny_unknown_fields
429)]
430#[schemars(crate = "printobserver_types::schemars")]
431pub enum FrameCause {
432 Blank,
435 Undecodable,
437}
438
439impl Sample for FrameCause {
440 fn sample_full() -> Self {
441 Self::Blank
442 }
443
444 fn sample_alternates() -> Vec<Self> {
445 vec![Self::Undecodable]
446 }
447}
448
449#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
455#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
456#[schemars(crate = "printobserver_types::schemars")]
457pub struct CameraDegradedPayload {
458 pub attempts: u32,
460 pub cause: FrameCause,
462 pub detail: String,
464}
465
466impl EventPayload for CameraDegradedPayload {
467 const KIND: &'static str = "camera_degraded";
468}
469
470impl Sample for CameraDegradedPayload {
471 fn sample_full() -> Self {
472 Self {
473 attempts: 3,
474 cause: FrameCause::Blank,
475 detail: "every frame was near-uniform grey (grey-level spread 2.1 below 36.5)"
476 .to_owned(),
477 }
478 }
479
480 fn sample_alternates() -> Vec<Self> {
481 vec![Self {
482 cause: FrameCause::Undecodable,
483 detail: "every frame failed a strict decode: the image ends early".to_owned(),
484 ..Self::sample_full()
485 }]
486 }
487}
488
489#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
495#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
496#[schemars(crate = "printobserver_types::schemars")]
497pub struct GcodeIndexedPayload {
498 pub file_name: FileName,
500 pub bytes: u64,
502 pub layers: u64,
504}
505
506impl EventPayload for GcodeIndexedPayload {
507 const KIND: &'static str = "gcode_indexed";
508}
509
510impl Sample for GcodeIndexedPayload {
511 fn sample_full() -> Self {
512 Self {
513 file_name: FileName::sample_full(),
514 bytes: 440_608,
515 layers: 150,
516 }
517 }
518}
519
520#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
529#[serde(
530 crate = "printobserver_types::serde",
531 rename_all = "snake_case",
532 deny_unknown_fields
533)]
534#[schemars(crate = "printobserver_types::schemars")]
535pub enum PortFailureSite {
536 PrinterSnapshot,
538 PrinterJob,
540 ImageWrite,
542 SupervisionTurn,
544 CameraLook,
547 DetectorAcknowledgement,
549 DetectorHealthCheck,
552 DetectorScoringRead,
555}
556
557impl Sample for PortFailureSite {
558 fn sample_full() -> Self {
559 Self::PrinterSnapshot
560 }
561}
562
563#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
571#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
572#[schemars(crate = "printobserver_types::schemars")]
573pub struct PortFailurePayload {
574 pub event_id: EventId,
576 pub site: PortFailureSite,
578 pub detail: String,
580}
581
582impl EventPayload for PortFailurePayload {
583 const KIND: &'static str = "port_failure";
584}
585
586impl Sample for PortFailurePayload {
587 fn sample_full() -> Self {
588 Self {
589 event_id: EventId::sample_full(),
590 site: PortFailureSite::sample_full(),
591 detail: "the printer is unreachable: connection refused".to_owned(),
592 }
593 }
594}
595
596pub const TIMELINE_KINDS: [&str; 24] = [
601 PrintStartedPayload::KIND,
602 PrintEndedPayload::KIND,
603 FilamentConsumedPayload::KIND,
604 SpoolRegisteredPayload::KIND,
605 SpoolLoadedPayload::KIND,
606 SpoolUnloadedPayload::KIND,
607 SpoolAdjustedPayload::KIND,
608 SpoolRetiredPayload::KIND,
609 SpoolCommandRejectedPayload::KIND,
610 SpoolUnverifiedPayload::KIND,
611 FilamentChangeSignalledPayload::KIND,
612 UnaccountedPrintPayload::KIND,
613 PreflightCheckedPayload::KIND,
614 ChargePendedPayload::KIND,
615 PrintUntrackedPayload::KIND,
616 FileTallyRebaselinedPayload::KIND,
617 PrinterConnectionChangedPayload::KIND,
618 PrinterResetPayload::KIND,
619 UnattendedPrinterActivityPayload::KIND,
620 DetectorHealthChangedPayload::KIND,
621 RecoveryRequestedPayload::KIND,
622 RecoveryExecutedPayload::KIND,
623 RecoveryRejectedPayload::KIND,
624 BedClearAssertedPayload::KIND,
625];
626
627fn sample_spool_id() -> SpoolId {
629 SpoolId::sample_full()
630}
631
632fn sample_reason() -> String {
634 "the spool on the shelf changed".to_owned()
635}
636
637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
639#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
640#[schemars(crate = "printobserver_types::schemars")]
641pub struct PrintStartedPayload {
642 #[serde(default, skip_serializing_if = "Option::is_none")]
644 pub file_name: Option<String>,
645 #[serde(default, skip_serializing_if = "Option::is_none")]
648 pub started_by: Option<ActionId>,
649 pub loaded: Vec<LoadedSpool>,
651 #[serde(default, skip_serializing_if = "Option::is_none")]
653 pub preflight: Option<Preflight>,
654}
655
656impl EventPayload for PrintStartedPayload {
657 const KIND: &'static str = "print_started";
658}
659
660impl Sample for PrintStartedPayload {
661 fn sample_full() -> Self {
662 Self {
663 file_name: Some("benchy.gcode".to_owned()),
664 started_by: Some(ActionId::sample_full()),
665 loaded: vec![LoadedSpool::sample_full()],
666 preflight: Some(Preflight::sample_full()),
667 }
668 }
669
670 fn sample_minimal() -> Self {
671 Self {
672 file_name: None,
673 started_by: None,
674 loaded: Vec::new(),
675 preflight: None,
676 }
677 }
678}
679
680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
682#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
683#[schemars(crate = "printobserver_types::schemars")]
684pub struct PrintEndedPayload {
685 pub outcome: PrintOutcome,
687 pub state: PrinterState,
689 pub reason: String,
691 #[serde(default, skip_serializing_if = "Option::is_none")]
693 pub last_position: Option<FilePosition>,
694}
695
696impl EventPayload for PrintEndedPayload {
697 const KIND: &'static str = "print_ended";
698}
699
700impl Sample for PrintEndedPayload {
701 fn sample_full() -> Self {
702 Self {
703 outcome: PrintOutcome::Cancelled,
704 state: PrinterState::Cancelling,
705 reason: "the operator cancelled it".to_owned(),
706 last_position: Some(FilePosition::sample_full()),
707 }
708 }
709
710 fn sample_minimal() -> Self {
711 Self {
712 outcome: PrintOutcome::Completed,
713 state: PrinterState::Operational,
714 reason: "finished".to_owned(),
715 last_position: None,
716 }
717 }
718}
719
720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
722#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
723#[schemars(crate = "printobserver_types::schemars")]
724pub struct FilamentConsumedPayload {
725 pub charge_key: ChargeKey,
727 pub tool: i64,
729 pub method: ChargeMethod,
731 pub length_mm: f64,
733 #[serde(default, skip_serializing_if = "Option::is_none")]
737 pub charged: Option<ChargedFilament>,
738 #[serde(default, skip_serializing_if = "Option::is_none")]
740 pub analysed_length_mm: Option<f64>,
741 #[serde(default, skip_serializing_if = "Option::is_none")]
743 pub position: Option<FilePosition>,
744 #[serde(default, skip_serializing_if = "Option::is_none")]
746 pub note: Option<String>,
747}
748
749impl EventPayload for FilamentConsumedPayload {
750 const KIND: &'static str = "filament_consumed";
751}
752
753impl Sample for FilamentConsumedPayload {
754 fn sample_full() -> Self {
755 Self {
756 charge_key: ChargeKey::sample_full(),
757 tool: 0,
758 method: ChargeMethod::GcodeExtrusion,
759 length_mm: 1_000.0,
760 charged: Some(ChargedFilament::sample_full()),
761 analysed_length_mm: Some(5_120.0),
762 position: Some(FilePosition::sample_full()),
763 note: Some("charged up to the filament change".to_owned()),
764 }
765 }
766
767 fn sample_minimal() -> Self {
768 Self {
769 charge_key: ChargeKey::sample_full(),
770 tool: 0,
771 method: ChargeMethod::SlicerEstimate,
772 length_mm: 5_120.0,
773 charged: None,
774 analysed_length_mm: None,
775 position: None,
776 note: None,
777 }
778 }
779}
780
781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
783#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
784#[schemars(crate = "printobserver_types::schemars")]
785pub struct SpoolRegisteredPayload {
786 pub spool: SpoolRecord,
788 pub actor: Actor,
790 pub reason: String,
792}
793
794impl EventPayload for SpoolRegisteredPayload {
795 const KIND: &'static str = "spool_registered";
796}
797
798impl Sample for SpoolRegisteredPayload {
799 fn sample_full() -> Self {
800 Self {
801 spool: SpoolRecord::sample_full(),
802 actor: Actor::Operator,
803 reason: sample_reason(),
804 }
805 }
806
807 fn sample_minimal() -> Self {
808 Self {
809 spool: SpoolRecord::sample_minimal(),
810 ..Self::sample_full()
811 }
812 }
813}
814
815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
817#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
818#[schemars(crate = "printobserver_types::schemars")]
819pub struct SpoolLoadedPayload {
820 pub spool_id: SpoolId,
822 pub tool: i64,
824 #[serde(default, skip_serializing_if = "Option::is_none")]
826 pub replaced: Option<SpoolId>,
827 #[serde(default, skip_serializing_if = "Vec::is_empty")]
830 pub took_pending: Vec<PendingTaken>,
831 #[serde(default, skip_serializing_if = "Vec::is_empty")]
833 pub cleared_marks: Vec<ClearedMark>,
834 pub actor: Actor,
836 pub reason: String,
838}
839
840impl EventPayload for SpoolLoadedPayload {
841 const KIND: &'static str = "spool_loaded";
842}
843
844impl Sample for SpoolLoadedPayload {
845 fn sample_full() -> Self {
846 Self {
847 spool_id: sample_spool_id(),
848 tool: 0,
849 replaced: Some(ClearedMark::sample_full().spool_id),
850 took_pending: vec![PendingTaken::sample_full()],
851 cleared_marks: vec![ClearedMark::sample_full()],
852 actor: Actor::Operator,
853 reason: sample_reason(),
854 }
855 }
856
857 fn sample_minimal() -> Self {
858 Self {
859 replaced: None,
860 took_pending: Vec::new(),
861 cleared_marks: Vec::new(),
862 ..Self::sample_full()
863 }
864 }
865}
866
867#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
869#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
870#[schemars(crate = "printobserver_types::schemars")]
871pub struct SpoolUnloadedPayload {
872 pub spool_id: SpoolId,
874 pub tool: i64,
876 pub actor: Actor,
878 pub reason: String,
880}
881
882impl EventPayload for SpoolUnloadedPayload {
883 const KIND: &'static str = "spool_unloaded";
884}
885
886impl Sample for SpoolUnloadedPayload {
887 fn sample_full() -> Self {
888 Self {
889 spool_id: sample_spool_id(),
890 tool: 0,
891 actor: Actor::Operator,
892 reason: sample_reason(),
893 }
894 }
895}
896
897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
899#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
900#[schemars(crate = "printobserver_types::schemars")]
901pub struct SpoolAdjustedPayload {
902 pub spool_id: SpoolId,
904 pub remaining_before_g: f64,
906 pub remaining_after_g: f64,
908 #[serde(default, skip_serializing_if = "Option::is_none")]
911 pub gross_g: Option<f64>,
912 #[serde(default, skip_serializing_if = "Vec::is_empty")]
915 pub took_pending: Vec<PendingTaken>,
916 #[serde(default, skip_serializing_if = "Vec::is_empty")]
918 pub cleared_marks: Vec<ClearedMark>,
919 pub actor: Actor,
921 pub reason: String,
923}
924
925impl EventPayload for SpoolAdjustedPayload {
926 const KIND: &'static str = "spool_adjusted";
927}
928
929impl Sample for SpoolAdjustedPayload {
930 fn sample_full() -> Self {
931 Self {
932 spool_id: sample_spool_id(),
933 remaining_before_g: 742.5,
934 remaining_after_g: 700.0,
935 gross_g: Some(950.0),
936 took_pending: vec![PendingTaken::sample_full()],
937 cleared_marks: vec![ClearedMark {
938 spool_id: sample_spool_id(),
939 reason: UnverifiedReason::sample_full(),
940 }],
941 actor: Actor::Operator,
942 reason: sample_reason(),
943 }
944 }
945
946 fn sample_minimal() -> Self {
947 Self {
948 gross_g: None,
949 took_pending: Vec::new(),
950 cleared_marks: Vec::new(),
951 ..Self::sample_full()
952 }
953 }
954}
955
956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
958#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
959#[schemars(crate = "printobserver_types::schemars")]
960pub struct SpoolRetiredPayload {
961 pub spool_id: SpoolId,
963 pub remaining_g: f64,
965 pub actor: Actor,
967 pub reason: String,
969}
970
971impl EventPayload for SpoolRetiredPayload {
972 const KIND: &'static str = "spool_retired";
973}
974
975impl Sample for SpoolRetiredPayload {
976 fn sample_full() -> Self {
977 Self {
978 spool_id: sample_spool_id(),
979 remaining_g: 12.5,
980 actor: Actor::Operator,
981 reason: "the spool is empty".to_owned(),
982 }
983 }
984}
985
986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
988#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
989#[schemars(crate = "printobserver_types::schemars")]
990pub struct SpoolCommandRejectedPayload {
991 pub command: SpoolCommand,
993 pub decision: PolicyDecision,
995}
996
997impl EventPayload for SpoolCommandRejectedPayload {
998 const KIND: &'static str = "spool_command_rejected";
999}
1000
1001impl Sample for SpoolCommandRejectedPayload {
1002 fn sample_full() -> Self {
1003 Self {
1004 command: SpoolCommand::sample_full(),
1005 decision: PolicyDecision::Rejected(crate::records::RejectionReason::SpoolRefused {
1006 cause: crate::records::SpoolRefusalCause::DensityRequired {
1007 spool_id: None,
1008 material: "PEEK".to_owned(),
1009 },
1010 message: "PEEK has no known density, so the spool needs one".to_owned(),
1011 }),
1012 }
1013 }
1014
1015 fn sample_minimal() -> Self {
1016 Self {
1017 command: SpoolCommand::sample_minimal(),
1018 ..Self::sample_full()
1019 }
1020 }
1021}
1022
1023#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1025#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1026#[schemars(crate = "printobserver_types::schemars")]
1027pub struct SpoolUnverifiedPayload {
1028 pub spool_id: SpoolId,
1030 pub reason: UnverifiedReason,
1032}
1033
1034impl EventPayload for SpoolUnverifiedPayload {
1035 const KIND: &'static str = "spool_unverified";
1036}
1037
1038impl Sample for SpoolUnverifiedPayload {
1039 fn sample_full() -> Self {
1040 Self {
1041 spool_id: sample_spool_id(),
1042 reason: UnverifiedReason::sample_full(),
1043 }
1044 }
1045}
1046
1047#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1049#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1050#[schemars(crate = "printobserver_types::schemars")]
1051pub struct FilamentChangeSignalledPayload {
1052 #[serde(default, skip_serializing_if = "Option::is_none")]
1054 pub tool: Option<i64>,
1055 #[serde(default, skip_serializing_if = "Option::is_none")]
1057 pub spool_id: Option<SpoolId>,
1058 pub source_kind: EventKind,
1060 #[serde(default, skip_serializing_if = "Option::is_none")]
1063 pub position: Option<SignalPosition>,
1064 #[serde(default, skip_serializing_if = "Option::is_none")]
1068 pub planned_change: Option<u32>,
1069}
1070
1071#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1073#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1074#[schemars(crate = "printobserver_types::schemars")]
1075pub struct SignalPosition {
1076 pub position: FilePosition,
1078 pub freshness: PositionFreshness,
1081}
1082
1083#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1085#[serde(crate = "printobserver_types::serde", rename_all = "snake_case")]
1086#[schemars(crate = "printobserver_types::schemars")]
1087pub enum PositionFreshness {
1088 ReadAtSignal,
1090 LastRecorded,
1093}
1094
1095impl EventPayload for FilamentChangeSignalledPayload {
1096 const KIND: &'static str = "filament_change_signalled";
1097}
1098
1099impl Sample for FilamentChangeSignalledPayload {
1100 fn sample_full() -> Self {
1101 Self {
1102 tool: Some(0),
1103 spool_id: Some(sample_spool_id()),
1104 source_kind: EventKind::new("obico_printer_notification").expect("a kind name"),
1105 position: Some(SignalPosition {
1106 position: FilePosition::sample_full(),
1107 freshness: PositionFreshness::ReadAtSignal,
1108 }),
1109 planned_change: Some(0),
1110 }
1111 }
1112
1113 fn sample_minimal() -> Self {
1114 Self {
1115 tool: None,
1116 spool_id: None,
1117 position: None,
1118 planned_change: None,
1119 ..Self::sample_full()
1120 }
1121 }
1122}
1123
1124#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1126#[serde(crate = "printobserver_types::serde", rename_all = "snake_case")]
1127#[schemars(crate = "printobserver_types::schemars")]
1128pub enum PlannedChangeTrigger {
1129 Signal,
1131 Position,
1133}
1134
1135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1142#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1143#[schemars(
1144 crate = "printobserver_types::schemars",
1145 transform = crate::gcode_index::null_is_sent
1146)]
1147pub struct FilamentChangePlannedReachedPayload {
1148 pub change: PlannedChange,
1150 pub previous_color: Option<String>,
1153 pub trigger: PlannedChangeTrigger,
1155 pub position: FilePosition,
1157 pub spool_id: Option<SpoolId>,
1160 pub next_spool_id: Option<SpoolId>,
1163 pub next_segment_filament_mm: f64,
1165}
1166
1167impl EventPayload for FilamentChangePlannedReachedPayload {
1168 const KIND: &'static str = "filament_change_planned_reached";
1169}
1170
1171impl Sample for FilamentChangePlannedReachedPayload {
1172 fn sample_full() -> Self {
1173 Self {
1174 change: PlannedChange::sample_full(),
1175 previous_color: Some("#FFFFFF".to_owned()),
1176 trigger: PlannedChangeTrigger::Position,
1177 position: FilePosition::sample_full(),
1178 spool_id: Some(sample_spool_id()),
1179 next_spool_id: Some(sample_spool_id()),
1180 next_segment_filament_mm: 812.4,
1181 }
1182 }
1183
1184 fn sample_alternates() -> Vec<Self> {
1185 vec![Self {
1186 previous_color: None,
1187 trigger: PlannedChangeTrigger::Signal,
1188 spool_id: None,
1189 next_spool_id: None,
1190 ..Self::sample_full()
1191 }]
1192 }
1193}
1194
1195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1199#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1200#[schemars(
1201 crate = "printobserver_types::schemars",
1202 transform = crate::gcode_index::null_is_sent
1203)]
1204pub struct FilamentChangePlannedResumedPayload {
1205 pub change: PlannedChange,
1207 pub previous_color: Option<String>,
1210 pub waited_s: i64,
1212 pub position: FilePosition,
1214}
1215
1216impl EventPayload for FilamentChangePlannedResumedPayload {
1217 const KIND: &'static str = "filament_change_planned_resumed";
1218}
1219
1220impl Sample for FilamentChangePlannedResumedPayload {
1221 fn sample_full() -> Self {
1222 Self {
1223 change: PlannedChange::sample_full(),
1224 previous_color: Some("#FFFFFF".to_owned()),
1225 waited_s: 412,
1226 position: FilePosition::sample_full(),
1227 }
1228 }
1229
1230 fn sample_alternates() -> Vec<Self> {
1231 vec![Self {
1232 previous_color: None,
1233 ..Self::sample_full()
1234 }]
1235 }
1236}
1237
1238#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1240#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1241#[schemars(crate = "printobserver_types::schemars")]
1242pub struct UnaccountedPrintPayload {
1243 pub file_name: String,
1245 #[serde(default, skip_serializing_if = "Option::is_none")]
1247 pub printed_at: Option<Timestamp>,
1248 pub success: bool,
1251 pub charged: bool,
1254}
1255
1256impl EventPayload for UnaccountedPrintPayload {
1257 const KIND: &'static str = "unaccounted_print";
1258}
1259
1260impl Sample for UnaccountedPrintPayload {
1261 fn sample_full() -> Self {
1262 Self {
1263 file_name: "benchy.gcode".to_owned(),
1264 printed_at: Some(Timestamp::sample_full()),
1265 success: true,
1266 charged: true,
1267 }
1268 }
1269
1270 fn sample_minimal() -> Self {
1271 Self {
1272 printed_at: None,
1273 success: false,
1274 charged: false,
1275 ..Self::sample_full()
1276 }
1277 }
1278}
1279
1280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1282#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1283#[schemars(crate = "printobserver_types::schemars")]
1284pub struct PreflightCheckedPayload {
1285 pub preflight: Preflight,
1287 #[serde(default, skip_serializing_if = "Option::is_none")]
1289 pub action_id: Option<ActionId>,
1290}
1291
1292impl EventPayload for PreflightCheckedPayload {
1293 const KIND: &'static str = "preflight_checked";
1294}
1295
1296impl Sample for PreflightCheckedPayload {
1297 fn sample_full() -> Self {
1298 Self {
1299 preflight: Preflight::sample_full(),
1300 action_id: Some(ActionId::sample_full()),
1301 }
1302 }
1303
1304 fn sample_minimal() -> Self {
1305 Self {
1306 action_id: None,
1307 ..Self::sample_full()
1308 }
1309 }
1310}
1311
1312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1315#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1316#[schemars(crate = "printobserver_types::schemars")]
1317pub struct ChargePendedPayload {
1318 pub pending: PendingCharge,
1320}
1321
1322impl EventPayload for ChargePendedPayload {
1323 const KIND: &'static str = "charge_pended";
1324}
1325
1326impl Sample for ChargePendedPayload {
1327 fn sample_full() -> Self {
1328 Self {
1329 pending: PendingCharge::sample_full(),
1330 }
1331 }
1332
1333 fn sample_minimal() -> Self {
1334 Self {
1335 pending: PendingCharge::sample_minimal(),
1336 }
1337 }
1338}
1339
1340#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1343#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1344#[schemars(crate = "printobserver_types::schemars")]
1345pub struct PrintUntrackedPayload {
1346 pub reason: String,
1348}
1349
1350impl EventPayload for PrintUntrackedPayload {
1351 const KIND: &'static str = "print_untracked";
1352}
1353
1354impl Sample for PrintUntrackedPayload {
1355 fn sample_full() -> Self {
1356 Self {
1357 reason: "the print was already running when spool tracking was installed".to_owned(),
1358 }
1359 }
1360}
1361
1362#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1364#[serde(crate = "printobserver_types::serde", rename_all = "snake_case")]
1365#[schemars(crate = "printobserver_types::schemars")]
1366pub enum RebaselineDisposition {
1367 Accounted,
1369 Unverified,
1372}
1373
1374impl Sample for RebaselineDisposition {
1375 fn sample_full() -> Self {
1376 Self::Unverified
1377 }
1378}
1379
1380#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1386#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1387#[schemars(crate = "printobserver_types::schemars")]
1388pub struct FileTallyRebaselinedPayload {
1389 pub file_name: String,
1391 pub origin: String,
1393 pub old_generation: u32,
1395 pub new_generation: u32,
1397 pub old_successes: i64,
1399 pub old_failures: i64,
1401 pub new_successes: i64,
1403 pub new_failures: i64,
1405 pub disposition: RebaselineDisposition,
1407}
1408
1409impl EventPayload for FileTallyRebaselinedPayload {
1410 const KIND: &'static str = "file_tally_rebaselined";
1411}
1412
1413impl Sample for FileTallyRebaselinedPayload {
1414 fn sample_full() -> Self {
1415 Self {
1416 file_name: "benchy.gcode".to_owned(),
1417 origin: "local".to_owned(),
1418 old_generation: 0,
1419 new_generation: 1,
1420 old_successes: 5,
1421 old_failures: 1,
1422 new_successes: 1,
1423 new_failures: 0,
1424 disposition: RebaselineDisposition::Unverified,
1425 }
1426 }
1427
1428 fn sample_alternates() -> Vec<Self> {
1429 vec![Self {
1430 disposition: RebaselineDisposition::Accounted,
1431 ..Self::sample_full()
1432 }]
1433 }
1434}
1435
1436#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1441#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1442#[schemars(crate = "printobserver_types::schemars")]
1443pub struct PrinterConnectionChangedPayload {
1444 pub from: PrinterState,
1446 pub to: PrinterState,
1448 pub detail: String,
1450}
1451
1452impl EventPayload for PrinterConnectionChangedPayload {
1453 const KIND: &'static str = "printer_connection_changed";
1454}
1455
1456impl Sample for PrinterConnectionChangedPayload {
1457 fn sample_full() -> Self {
1458 Self {
1459 from: PrinterState::Printing,
1460 to: PrinterState::Offline,
1461 detail: "the printer reports Offline after error: SerialTimeoutException: ".to_owned(),
1462 }
1463 }
1464
1465 fn sample_alternates() -> Vec<Self> {
1466 vec![Self {
1467 from: PrinterState::Offline,
1468 to: PrinterState::Operational,
1469 detail: "the printer reports Operational".to_owned(),
1470 }]
1471 }
1472}
1473
1474#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1481#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1482#[schemars(crate = "printobserver_types::schemars")]
1483pub struct PrinterResetPayload {
1484 #[serde(default)]
1486 pub during_print: Option<PrintId>,
1487 pub detail: String,
1489}
1490
1491impl EventPayload for PrinterResetPayload {
1492 const KIND: &'static str = "printer_reset";
1493}
1494
1495impl Sample for PrinterResetPayload {
1496 fn sample_full() -> Self {
1497 Self {
1498 during_print: Some(PrintId::sample_full()),
1499 detail: "the printer pushed a reset".to_owned(),
1500 }
1501 }
1502
1503 fn sample_minimal() -> Self {
1504 Self {
1505 during_print: None,
1506 detail: "the printer pushed a reset".to_owned(),
1507 }
1508 }
1509}
1510
1511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1513#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1514#[schemars(crate = "printobserver_types::schemars")]
1515pub struct HeatedTool {
1516 pub tool: i64,
1518 pub target_c: f64,
1520}
1521
1522impl Sample for HeatedTool {
1523 fn sample_full() -> Self {
1524 Self {
1525 tool: 0,
1526 target_c: 215.0,
1527 }
1528 }
1529}
1530
1531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1539#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1540#[schemars(crate = "printobserver_types::schemars")]
1541pub struct UnattendedPrinterActivityPayload {
1542 pub last_print_id: PrintId,
1544 pub tools: Vec<HeatedTool>,
1546 #[serde(default)]
1548 pub bed_target_c: Option<f64>,
1549 #[serde(default)]
1552 pub moved: Option<bool>,
1553 pub detail: String,
1555}
1556
1557impl EventPayload for UnattendedPrinterActivityPayload {
1558 const KIND: &'static str = "unattended_printer_activity";
1559}
1560
1561impl Sample for UnattendedPrinterActivityPayload {
1562 fn sample_full() -> Self {
1563 Self {
1564 last_print_id: PrintId::sample_full(),
1565 tools: vec![HeatedTool::sample_full()],
1566 bed_target_c: Some(60.0),
1567 moved: Some(true),
1568 detail: "tool 0 is heating to 215 °C with no job running".to_owned(),
1569 }
1570 }
1571
1572 fn sample_minimal() -> Self {
1573 Self {
1574 last_print_id: PrintId::sample_full(),
1575 tools: Vec::new(),
1576 bed_target_c: None,
1577 moved: None,
1578 detail: "the print head moved with no job running".to_owned(),
1579 }
1580 }
1581}
1582
1583#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1585#[serde(
1586 crate = "printobserver_types::serde",
1587 rename_all = "snake_case",
1588 deny_unknown_fields
1589)]
1590#[schemars(crate = "printobserver_types::schemars")]
1591pub enum DetectorStatus {
1592 Available,
1594 Unavailable,
1596}
1597
1598impl Sample for DetectorStatus {
1599 fn sample_full() -> Self {
1600 Self::Unavailable
1601 }
1602
1603 fn sample_alternates() -> Vec<Self> {
1604 vec![Self::Available]
1605 }
1606}
1607
1608#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1612#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1613#[schemars(crate = "printobserver_types::schemars")]
1614pub struct DetectorHealthChangedPayload {
1615 pub status: DetectorStatus,
1617 pub detail: String,
1619}
1620
1621impl EventPayload for DetectorHealthChangedPayload {
1622 const KIND: &'static str = "detector_health_changed";
1623}
1624
1625impl Sample for DetectorHealthChangedPayload {
1626 fn sample_full() -> Self {
1627 Self {
1628 status: DetectorStatus::Unavailable,
1629 detail: "the detector's health check answered 503".to_owned(),
1630 }
1631 }
1632
1633 fn sample_alternates() -> Vec<Self> {
1634 vec![Self {
1635 status: DetectorStatus::Available,
1636 detail: "the detector's health check answered 200".to_owned(),
1637 }]
1638 }
1639}
1640
1641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1645#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1646#[schemars(crate = "printobserver_types::schemars")]
1647pub struct RecoveryRequestedPayload {
1648 pub action: RecoveryAction,
1650 pub actor: Actor,
1652 pub reason: String,
1654 #[serde(default, skip_serializing_if = "Option::is_none")]
1658 pub bed_clear: Option<EventId>,
1659}
1660
1661impl EventPayload for RecoveryRequestedPayload {
1662 const KIND: &'static str = "recovery_requested";
1663}
1664
1665impl Sample for RecoveryRequestedPayload {
1666 fn sample_full() -> Self {
1667 Self {
1668 action: RecoveryAction::sample_full(),
1669 actor: Actor::Operator,
1670 reason: "free the nozzle from the part".to_owned(),
1671 bed_clear: Some(EventId::sample_full()),
1672 }
1673 }
1674
1675 fn sample_minimal() -> Self {
1676 Self {
1677 bed_clear: None,
1678 ..Self::sample_full()
1679 }
1680 }
1681}
1682
1683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1685#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1686#[schemars(crate = "printobserver_types::schemars")]
1687pub struct RecoveryExecutedPayload {
1688 pub action: RecoveryAction,
1690 pub actor: Actor,
1692 pub reason: String,
1694 pub outcome: crate::records::ExecutionOutcome,
1696 #[serde(default, skip_serializing_if = "Option::is_none")]
1700 pub bed_clear: Option<EventId>,
1701}
1702
1703impl EventPayload for RecoveryExecutedPayload {
1704 const KIND: &'static str = "recovery_executed";
1705}
1706
1707impl Sample for RecoveryExecutedPayload {
1708 fn sample_full() -> Self {
1709 Self {
1710 action: RecoveryAction::RecoverLift { mm: 10.0 },
1711 actor: Actor::Operator,
1712 reason: "free the nozzle from the part".to_owned(),
1713 outcome: crate::records::ExecutionOutcome::Succeeded,
1714 bed_clear: Some(EventId::sample_full()),
1715 }
1716 }
1717
1718 fn sample_minimal() -> Self {
1719 Self {
1720 bed_clear: None,
1721 ..Self::sample_full()
1722 }
1723 }
1724
1725 fn sample_alternates() -> Vec<Self> {
1726 vec![Self {
1727 outcome: crate::records::ExecutionOutcome::Failed {
1728 reason: "the printer is unreachable: connection refused".to_owned(),
1729 },
1730 ..Self::sample_full()
1731 }]
1732 }
1733}
1734
1735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1737#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1738#[schemars(crate = "printobserver_types::schemars")]
1739pub struct RecoveryRejectedPayload {
1740 pub action: RecoveryAction,
1742 pub actor: Actor,
1744 pub reason: String,
1746 pub rejection: RecoveryRejection,
1748}
1749
1750impl EventPayload for RecoveryRejectedPayload {
1751 const KIND: &'static str = "recovery_rejected";
1752}
1753
1754impl Sample for RecoveryRejectedPayload {
1755 fn sample_full() -> Self {
1756 Self {
1757 action: RecoveryAction::RecoverPark {
1758 clearance_asserted: false,
1759 },
1760 actor: Actor::Operator,
1761 reason: "move the head off the part".to_owned(),
1762 rejection: RecoveryRejection::sample_full(),
1763 }
1764 }
1765}
1766
1767#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1778#[serde(crate = "printobserver_types::serde", deny_unknown_fields)]
1779#[schemars(crate = "printobserver_types::schemars")]
1780pub struct BedClearAssertedPayload {
1781 pub actor: BedClearActor,
1783 pub reason: String,
1785}
1786
1787#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
1793#[serde(crate = "printobserver_types::serde", rename_all = "snake_case")]
1794#[schemars(crate = "printobserver_types::schemars")]
1795pub enum BedClearActor {
1796 Operator,
1798}
1799
1800impl BedClearActor {
1801 #[must_use]
1803 pub const fn actor(self) -> Actor {
1804 match self {
1805 Self::Operator => Actor::Operator,
1806 }
1807 }
1808}
1809
1810impl EventPayload for BedClearAssertedPayload {
1811 const KIND: &'static str = "bed_clear_asserted";
1812}
1813
1814impl Sample for BedClearAssertedPayload {
1815 fn sample_full() -> Self {
1816 Self {
1817 actor: BedClearActor::Operator,
1818 reason: "the cancelled print is off the bed and nothing else is on it".to_owned(),
1819 }
1820 }
1821}