Skip to main content

phytrace_sdk/models/
enums.rs

1//! Enumeration types for the PhyTrace UDM.
2//!
3//! All enums are serialized using snake_case naming convention.
4
5use serde::{Deserialize, Serialize};
6
7// =============================================================================
8// Event Classification
9// =============================================================================
10
11/// Classification of UDM events.
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
13#[serde(rename_all = "snake_case")]
14pub enum EventType {
15    // Telemetry events
16    /// Periodic telemetry snapshot
17    #[default]
18    TelemetryPeriodic,
19    /// Telemetry triggered by significant change
20    TelemetryOnChange,
21    /// Full system snapshot
22    TelemetrySnapshot,
23
24    // State transition events
25    /// Robot state changed
26    StateTransition,
27    /// Operational mode changed
28    ModeChange,
29
30    // Task events
31    /// Task started
32    TaskStarted,
33    /// Task completed successfully
34    TaskCompleted,
35    /// Task failed
36    TaskFailed,
37    /// Task cancelled
38    TaskCancelled,
39
40    // Navigation events
41    /// Navigation goal reached
42    GoalReached,
43    /// Path blocked, replanning
44    PathBlocked,
45    /// Rerouting in progress
46    Rerouting,
47
48    // Safety events
49    /// Safety violation detected
50    SafetyViolation,
51    /// Emergency stop activated
52    EmergencyStop,
53
54    // System events
55    /// System startup
56    SystemStartup,
57    /// System shutdown
58    SystemShutdown,
59    /// Liveness heartbeat, sent every `heartbeat.interval_secs`; PhyCloud
60    /// flags a source silent for three intervals
61    SystemHeartbeat,
62    /// Signed baseline of the watched ROS 2 graph (PhyUDM `ros_graph`)
63    SecurityRosGraphBaseline,
64    /// The ROS 2 graph departed from its baseline
65    SecurityRosGraphChanged,
66    /// The ROS 2 graph can no longer be observed
67    SecurityRosGraphUnobservable,
68    /// Error occurred
69    Error,
70
71    // Custom events
72    /// Custom event type (use extensions for details)
73    Custom,
74}
75
76// =============================================================================
77// Source Classification
78// =============================================================================
79
80/// Classification of the telemetry source.
81#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
82#[serde(rename_all = "snake_case")]
83pub enum SourceType {
84    // Mobile robots
85    /// Autonomous Mobile Robot
86    #[default]
87    Amr,
88    /// Automated Guided Vehicle
89    Agv,
90    /// Autonomous Forklift
91    AutonomousForklift,
92    /// Delivery Robot
93    DeliveryRobot,
94    /// Cleaning Robot
95    CleaningRobot,
96    /// Inspection Robot
97    InspectionRobot,
98    /// Security Robot
99    SecurityRobot,
100
101    // Manipulators
102    /// Industrial Robot Arm
103    IndustrialArm,
104    /// Collaborative Robot (Cobot)
105    Cobot,
106    /// Mobile Manipulator
107    MobileManipulator,
108
109    // Vehicles
110    /// Autonomous Vehicle
111    AutonomousVehicle,
112    /// Electric Vehicle
113    ElectricVehicle,
114    /// Drone / UAV
115    Drone,
116
117    // Other
118    /// Humanoid Robot
119    Humanoid,
120    /// Quadruped Robot
121    Quadruped,
122    /// Human (for tracking humans in simulation/HRI scenarios)
123    Human,
124    /// Custom Platform
125    Custom,
126    /// Simulation Instance
127    Simulation,
128}
129
130// =============================================================================
131// Operational Enums
132// =============================================================================
133
134/// Operational mode of the robot.
135#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
136#[serde(rename_all = "snake_case")]
137pub enum OperationalMode {
138    /// Fully autonomous operation
139    #[default]
140    Autonomous,
141    /// Manual control (teleoperation)
142    Manual,
143    /// Semi-autonomous with human oversight
144    SemiAutonomous,
145    /// Remote teleoperation
146    Teleoperated,
147    /// Learning/training mode
148    Learning,
149    /// Maintenance mode
150    Maintenance,
151    /// Emergency mode
152    Emergency,
153    /// Idle/standby
154    Idle,
155}
156
157/// Current operational state of the robot.
158#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
159#[serde(rename_all = "snake_case")]
160pub enum OperationalState {
161    /// Powered off
162    Off,
163    /// Booting up
164    Booting,
165    /// Ready and waiting
166    #[default]
167    Ready,
168    /// Executing a task
169    ExecutingTask,
170    /// Navigating to destination
171    Navigating,
172    /// Performing manipulation
173    Manipulating,
174    /// Charging
175    Charging,
176    /// Paused
177    Paused,
178    /// In error state
179    Error,
180    /// Emergency stopped
181    EmergencyStopped,
182    /// Shutting down
183    ShuttingDown,
184    /// In recovery mode
185    Recovering,
186}
187
188/// Error severity levels.
189#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
190#[serde(rename_all = "snake_case")]
191pub enum ErrorSeverity {
192    /// Informational message
193    #[default]
194    Info,
195    /// Warning - operation can continue
196    Warning,
197    /// Error - operation may be impacted
198    Error,
199    /// Critical - immediate attention required
200    Critical,
201    /// Fatal - system cannot continue
202    Fatal,
203}
204
205// =============================================================================
206// Motion Enums
207// =============================================================================
208
209/// Current motion state.
210#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
211#[serde(rename_all = "snake_case")]
212pub enum MotionState {
213    /// Not moving
214    #[default]
215    Stationary,
216    /// Moving at constant velocity
217    Moving,
218    /// Accelerating
219    Accelerating,
220    /// Decelerating
221    Decelerating,
222    /// Rotating in place
223    Rotating,
224    /// Reversing
225    Reversing,
226}
227
228// =============================================================================
229// Power Enums
230// =============================================================================
231
232/// Battery chemistry type.
233#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
234#[serde(rename_all = "snake_case")]
235pub enum BatteryChemistry {
236    /// Lithium Iron Phosphate
237    #[default]
238    LiFePo4,
239    /// Lithium Nickel Manganese Cobalt
240    Nmc,
241    /// Lithium Cobalt Oxide
242    LiCoO2,
243    /// Lithium Manganese Oxide
244    Lmo,
245    /// Lead Acid
246    LeadAcid,
247    /// Nickel Metal Hydride
248    NiMh,
249    /// Solid State
250    SolidState,
251    /// Other/Unknown
252    Other,
253}
254
255/// Charging state.
256#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
257#[serde(rename_all = "snake_case")]
258pub enum ChargingState {
259    /// Not connected to charger
260    #[default]
261    NotCharging,
262    /// Connected, preparing to charge
263    Preparing,
264    /// Actively charging
265    Charging,
266    /// Charge complete, still connected
267    Complete,
268    /// Charging error
269    Error,
270}
271
272/// Power source type.
273#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
274#[serde(rename_all = "snake_case")]
275pub enum PowerSource {
276    /// Running on battery
277    #[default]
278    Battery,
279    /// Connected to external power
280    External,
281    /// Solar powered
282    Solar,
283    /// Fuel cell
284    FuelCell,
285    /// Hybrid
286    Hybrid,
287}
288
289// =============================================================================
290// Safety Enums
291// =============================================================================
292
293/// Overall safety state.
294#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
295#[serde(rename_all = "snake_case")]
296pub enum SafetyState {
297    /// Normal operation
298    #[default]
299    Normal,
300    /// Warning - proceed with caution
301    Warning,
302    /// Protective stop active
303    ProtectiveStop,
304    /// Emergency stop active
305    EmergencyStop,
306    /// Safety interlock triggered
307    SafetyInterlock,
308    /// Reduced speed mode
309    ReducedSpeed,
310}
311
312/// Emergency stop type.
313#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
314#[serde(rename_all = "snake_case")]
315pub enum EStopType {
316    /// Software-triggered e-stop
317    #[default]
318    Software,
319    /// Hardware button pressed
320    Hardware,
321    /// Remote e-stop signal
322    Remote,
323    /// Automatic safety system
324    Automatic,
325}
326
327/// Safety zone type.
328#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
329#[serde(rename_all = "snake_case")]
330pub enum SafetyZoneType {
331    /// Warning zone - reduce speed
332    #[default]
333    Warning,
334    /// Slowdown zone - significantly reduce speed
335    Slowdown,
336    /// Stop zone - immediate stop required
337    Stop,
338    /// Restricted zone - entry prohibited
339    Restricted,
340    /// Collaborative zone - human-robot interaction area
341    Collaborative,
342}
343
344/// Violation severity.
345#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
346#[serde(rename_all = "snake_case")]
347pub enum ViolationSeverity {
348    /// Low severity - logged only
349    #[default]
350    Low,
351    /// Medium severity - warning issued
352    Medium,
353    /// High severity - action required
354    High,
355    /// Critical - immediate stop
356    Critical,
357}
358
359/// Types of safety violations.
360#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
361#[serde(rename_all = "snake_case")]
362pub enum ViolationType {
363    /// Speed limit exceeded
364    #[default]
365    SpeedExceeded,
366    /// Entered restricted zone
367    ZoneViolation,
368    /// Too close to obstacle
369    ProximityViolation,
370    /// Collision detected
371    CollisionDetected,
372    /// Stability issue
373    StabilityViolation,
374    /// Force/torque limit exceeded
375    ForceLimitExceeded,
376    /// Communication loss
377    CommunicationLoss,
378    /// Sensor failure
379    SensorFailure,
380}
381
382// =============================================================================
383// Navigation Enums
384// =============================================================================
385
386/// Localization quality.
387#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
388#[serde(rename_all = "snake_case")]
389pub enum LocalizationQuality {
390    /// Excellent localization
391    Excellent,
392    /// Good localization
393    #[default]
394    Good,
395    /// Fair localization
396    Fair,
397    /// Poor localization
398    Poor,
399    /// Lost / unknown position
400    Lost,
401}
402
403/// Path planning state.
404#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
405#[serde(rename_all = "snake_case")]
406pub enum PathState {
407    /// No path planned
408    #[default]
409    None,
410    /// Path being computed
411    Planning,
412    /// Valid path available
413    Valid,
414    /// Executing current path
415    Executing,
416    /// Path blocked, replanning
417    Blocked,
418    /// Path completed
419    Completed,
420    /// Path planning failed
421    Failed,
422}
423
424/// Obstacle classification.
425#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
426#[serde(rename_all = "snake_case")]
427pub enum ObstacleType {
428    /// Unknown obstacle
429    #[default]
430    Unknown,
431    /// Static obstacle (wall, furniture)
432    Static,
433    /// Dynamic obstacle (person, other robot)
434    Dynamic,
435    /// Human detected
436    Human,
437    /// Another robot
438    Robot,
439    /// Vehicle
440    Vehicle,
441    /// Temporary obstacle
442    Temporary,
443}
444
445// =============================================================================
446// Perception Enums
447// =============================================================================
448
449/// Sensor status.
450#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
451#[serde(rename_all = "snake_case")]
452pub enum SensorStatus {
453    /// Sensor operating normally
454    #[default]
455    Ok,
456    /// Sensor degraded
457    Degraded,
458    /// Sensor error
459    Error,
460    /// Sensor offline
461    Offline,
462    /// Sensor calibrating
463    Calibrating,
464}
465
466/// GPS fix type.
467#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
468#[serde(rename_all = "snake_case")]
469pub enum GpsFixType {
470    /// No fix
471    #[default]
472    NoFix,
473    /// 2D fix
474    Fix2d,
475    /// 3D fix
476    Fix3d,
477    /// Differential GPS
478    Dgps,
479    /// RTK float
480    RtkFloat,
481    /// RTK fixed
482    RtkFixed,
483}
484
485/// Detection classification confidence.
486#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
487#[serde(rename_all = "snake_case")]
488pub enum DetectionConfidence {
489    /// Low confidence
490    Low,
491    /// Medium confidence
492    #[default]
493    Medium,
494    /// High confidence
495    High,
496    /// Very high confidence
497    VeryHigh,
498}
499
500// =============================================================================
501// Actuator Enums
502// =============================================================================
503
504/// Motor status.
505#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
506#[serde(rename_all = "snake_case")]
507pub enum MotorStatus {
508    /// Motor OK
509    #[default]
510    Ok,
511    /// Motor overheating
512    Overheating,
513    /// Motor overcurrent
514    Overcurrent,
515    /// Motor error
516    Error,
517    /// Motor disabled
518    Disabled,
519}
520
521/// Gripper state.
522#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
523#[serde(rename_all = "snake_case")]
524pub enum GripperState {
525    /// Gripper fully open
526    #[default]
527    Open,
528    /// Gripper fully closed
529    Closed,
530    /// Gripper partially closed / holding
531    Holding,
532    /// Gripper moving
533    Moving,
534    /// Gripper error
535    Error,
536}
537
538/// Lift position state.
539#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
540#[serde(rename_all = "snake_case")]
541pub enum LiftState {
542    /// Lift at bottom
543    #[default]
544    Lowered,
545    /// Lift at top
546    Raised,
547    /// Lift moving
548    Moving,
549    /// Lift at custom position
550    Intermediate,
551    /// Lift error
552    Error,
553}
554
555// =============================================================================
556// Communication Enums
557// =============================================================================
558
559/// Network connection type.
560#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
561#[serde(rename_all = "snake_case")]
562pub enum NetworkType {
563    /// WiFi connection
564    #[default]
565    Wifi,
566    /// Ethernet connection
567    Ethernet,
568    /// Cellular connection
569    Cellular,
570    /// LoRa connection
571    Lora,
572    /// Bluetooth
573    Bluetooth,
574    /// Mesh network
575    Mesh,
576}
577
578/// Connection status.
579#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
580#[serde(rename_all = "snake_case")]
581pub enum ConnectionStatus {
582    /// Connected
583    #[default]
584    Connected,
585    /// Disconnected
586    Disconnected,
587    /// Connecting
588    Connecting,
589    /// Connection error
590    Error,
591}
592
593/// Cellular generation.
594#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
595#[serde(rename_all = "snake_case")]
596pub enum CellularGeneration {
597    /// 3G
598    #[serde(rename = "3g")]
599    Gen3,
600    /// 4G LTE
601    #[default]
602    #[serde(rename = "4g")]
603    Gen4,
604    /// 5G
605    #[serde(rename = "5g")]
606    Gen5,
607}
608
609// =============================================================================
610// Payload Enums
611// =============================================================================
612
613/// Load status.
614#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
615#[serde(rename_all = "snake_case")]
616pub enum LoadStatus {
617    /// No load
618    #[default]
619    Empty,
620    /// Partially loaded
621    PartialLoad,
622    /// Fully loaded
623    FullLoad,
624    /// Overloaded (warning)
625    Overloaded,
626}
627
628// =============================================================================
629// Manipulation Enums
630// =============================================================================
631
632/// Arm state.
633#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
634#[serde(rename_all = "snake_case")]
635pub enum ArmState {
636    /// Arm at home position
637    #[default]
638    Home,
639    /// Arm moving
640    Moving,
641    /// Arm at target position
642    AtTarget,
643    /// Arm performing grasp
644    Grasping,
645    /// Arm placing object
646    Placing,
647    /// Arm in collision avoidance
648    Avoiding,
649    /// Arm error
650    Error,
651}
652
653/// Grasp phase.
654#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
655#[serde(rename_all = "snake_case")]
656pub enum GraspPhase {
657    /// Not grasping
658    #[default]
659    Idle,
660    /// Approaching target
661    Approaching,
662    /// Pre-grasp positioning
663    PreGrasp,
664    /// Closing gripper
665    Closing,
666    /// Grasp secured
667    Secured,
668    /// Lifting object
669    Lifting,
670    /// Grasp failed
671    Failed,
672}
673
674/// Control mode for manipulation.
675#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
676#[serde(rename_all = "snake_case")]
677pub enum ManipulationControlMode {
678    /// Position control
679    #[default]
680    Position,
681    /// Velocity control
682    Velocity,
683    /// Force/torque control
684    Force,
685    /// Impedance control
686    Impedance,
687    /// Hybrid control
688    Hybrid,
689}
690
691// =============================================================================
692// HRI (Human-Robot Interaction) Enums
693// =============================================================================
694
695/// Human-robot interaction state.
696#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
697#[serde(rename_all = "snake_case")]
698pub enum InteractionState {
699    /// No interaction
700    #[default]
701    None,
702    /// Human detected nearby
703    HumanDetected,
704    /// Awaiting human input
705    AwaitingInput,
706    /// Active interaction
707    Interacting,
708    /// Handover in progress
709    Handover,
710    /// Following human
711    Following,
712}
713
714/// Handover state.
715#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
716#[serde(rename_all = "snake_case")]
717pub enum HandoverState {
718    /// No handover
719    #[default]
720    None,
721    /// Offering object to human
722    Offering,
723    /// Receiving object from human
724    Receiving,
725    /// Handover complete
726    Complete,
727    /// Handover failed/aborted
728    Aborted,
729}
730
731/// Human activity classification.
732#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
733#[serde(rename_all = "snake_case")]
734pub enum HumanActivity {
735    /// Unknown activity
736    #[default]
737    Unknown,
738    /// Standing still
739    Standing,
740    /// Walking
741    Walking,
742    /// Running
743    Running,
744    /// Sitting
745    Sitting,
746    /// Working (e.g., at a station)
747    Working,
748    /// Gesturing
749    Gesturing,
750}
751
752// =============================================================================
753// Coordination Enums
754// =============================================================================
755
756/// Fleet coordination role.
757#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
758#[serde(rename_all = "snake_case")]
759pub enum FleetRole {
760    /// Independent operation
761    #[default]
762    Independent,
763    /// Fleet leader
764    Leader,
765    /// Fleet follower
766    Follower,
767    /// Swarm member
768    SwarmMember,
769    /// Coordinator node
770    Coordinator,
771}
772
773/// Formation type.
774#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
775#[serde(rename_all = "snake_case")]
776pub enum FormationType {
777    /// No formation
778    #[default]
779    None,
780    /// Line formation
781    Line,
782    /// Column formation
783    Column,
784    /// V formation
785    Vee,
786    /// Diamond formation
787    Diamond,
788    /// Circular formation
789    Circle,
790    /// Custom formation
791    Custom,
792}
793
794/// Traffic management priority.
795#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
796#[serde(rename_all = "snake_case")]
797pub enum TrafficPriority {
798    /// Low priority
799    Low,
800    /// Normal priority
801    #[default]
802    Normal,
803    /// High priority
804    High,
805    /// Emergency priority
806    Emergency,
807}
808
809// =============================================================================
810// Simulation Enums
811// =============================================================================
812
813/// Simulator type.
814#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
815#[serde(rename_all = "snake_case")]
816pub enum SimulatorType {
817    /// Gazebo simulator
818    #[default]
819    Gazebo,
820    /// NVIDIA Isaac Sim
821    IsaacSim,
822    /// Unity-based simulator
823    Unity,
824    /// Unreal Engine simulator
825    Unreal,
826    /// Webots simulator
827    Webots,
828    /// Custom Python simulator
829    CustomPython,
830    /// Other simulator
831    Other,
832}
833
834/// Simulation fidelity level.
835#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
836#[serde(rename_all = "snake_case")]
837pub enum SimulationFidelity {
838    /// Low fidelity (fast, less accurate)
839    Low,
840    /// Medium fidelity
841    #[default]
842    Medium,
843    /// High fidelity (slow, more accurate)
844    High,
845    /// Physics-accurate simulation
846    PhysicsAccurate,
847}
848
849// =============================================================================
850// Thermal Enums
851// =============================================================================
852
853/// Overall thermal state.
854#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
855#[serde(rename_all = "snake_case")]
856pub enum ThermalState {
857    /// Normal temperature
858    #[default]
859    Normal,
860    /// Elevated temperature (warning)
861    Elevated,
862    /// High temperature (throttling)
863    High,
864    /// Critical temperature (shutdown imminent)
865    Critical,
866    /// Cold (below optimal)
867    Cold,
868}
869
870/// Cooling system mode.
871#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
872#[serde(rename_all = "snake_case")]
873pub enum CoolingMode {
874    /// Passive cooling
875    #[default]
876    Passive,
877    /// Active cooling (fans)
878    Active,
879    /// Liquid cooling
880    Liquid,
881    /// Maximum cooling
882    Maximum,
883}
884
885// =============================================================================
886// Audio Enums
887// =============================================================================
888
889/// Sound detection classification.
890#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
891#[serde(rename_all = "snake_case")]
892pub enum SoundType {
893    /// Unknown sound
894    #[default]
895    Unknown,
896    /// Speech detected
897    Speech,
898    /// Alarm/siren
899    Alarm,
900    /// Impact/collision sound
901    Impact,
902    /// Machine noise
903    Machine,
904    /// Emergency sound
905    Emergency,
906}
907
908// =============================================================================
909// Environment Interaction Enums
910// =============================================================================
911
912/// Door state.
913#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
914#[serde(rename_all = "snake_case")]
915pub enum DoorState {
916    /// Door open
917    Open,
918    /// Door closed
919    #[default]
920    Closed,
921    /// Door opening
922    Opening,
923    /// Door closing
924    Closing,
925    /// Door locked
926    Locked,
927    /// Door error
928    Error,
929}
930
931/// Elevator state.
932#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
933#[serde(rename_all = "snake_case")]
934pub enum ElevatorState {
935    /// Elevator idle
936    #[default]
937    Idle,
938    /// Elevator called
939    Called,
940    /// Elevator arriving
941    Arriving,
942    /// Doors open, ready to board
943    DoorsOpen,
944    /// Robot boarding
945    Boarding,
946    /// In transit
947    InTransit,
948    /// Arrived at floor
949    Arrived,
950}
951
952/// Charging station state.
953#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
954#[serde(rename_all = "snake_case")]
955pub enum ChargingStationState {
956    /// Station available
957    #[default]
958    Available,
959    /// Station occupied
960    Occupied,
961    /// Station out of service
962    OutOfService,
963    /// Station reserved
964    Reserved,
965}
966
967// =============================================================================
968// Compliance Enums
969// =============================================================================
970
971/// Certification status.
972#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
973#[serde(rename_all = "snake_case")]
974pub enum CertificationStatus {
975    /// Not certified
976    #[default]
977    NotCertified,
978    /// Certification pending
979    Pending,
980    /// Certified
981    Certified,
982    /// Certification expired
983    Expired,
984}
985
986/// Functional safety level (ISO 13849 / IEC 62443).
987#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
988#[serde(rename_all = "snake_case")]
989pub enum SafetyIntegrityLevel {
990    /// No safety requirement
991    #[default]
992    None,
993    /// Performance Level a / SIL 1
994    PlA,
995    /// Performance Level b
996    PlB,
997    /// Performance Level c / SIL 2
998    PlC,
999    /// Performance Level d / SIL 3
1000    PlD,
1001    /// Performance Level e / SIL 4
1002    PlE,
1003}
1004
1005// =============================================================================
1006// AI / ML Enums
1007// =============================================================================
1008
1009/// AI model type.
1010#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1011#[serde(rename_all = "snake_case")]
1012pub enum ModelType {
1013    /// Object detection model
1014    #[default]
1015    ObjectDetection,
1016    /// Semantic segmentation
1017    SemanticSegmentation,
1018    /// Instance segmentation
1019    InstanceSegmentation,
1020    /// Pose estimation
1021    PoseEstimation,
1022    /// Depth estimation
1023    DepthEstimation,
1024    /// Navigation/planning
1025    Navigation,
1026    /// Anomaly detection
1027    AnomalyDetection,
1028    /// Speech recognition
1029    SpeechRecognition,
1030    /// Natural language understanding
1031    Nlu,
1032    /// Custom model
1033    Custom,
1034}
1035
1036/// AI inference device.
1037#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1038#[serde(rename_all = "snake_case")]
1039pub enum InferenceDevice {
1040    /// CPU inference
1041    #[default]
1042    Cpu,
1043    /// GPU inference
1044    Gpu,
1045    /// NPU/TPU inference
1046    Npu,
1047    /// Edge TPU
1048    EdgeTpu,
1049    /// FPGA
1050    Fpga,
1051}
1052
1053/// Anomaly severity.
1054#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1055#[serde(rename_all = "snake_case")]
1056pub enum AnomalySeverity {
1057    /// Low severity anomaly
1058    #[default]
1059    Low,
1060    /// Medium severity
1061    Medium,
1062    /// High severity
1063    High,
1064    /// Critical anomaly
1065    Critical,
1066}
1067
1068// =============================================================================
1069// Maintenance Enums
1070// =============================================================================
1071
1072/// Component health status.
1073#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1074#[serde(rename_all = "snake_case")]
1075pub enum ComponentHealth {
1076    /// Component healthy
1077    #[default]
1078    Healthy,
1079    /// Component degraded
1080    Degraded,
1081    /// Component needs attention
1082    NeedsAttention,
1083    /// Component failed
1084    Failed,
1085    /// Component status unknown
1086    Unknown,
1087}
1088
1089/// Maintenance urgency.
1090#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1091#[serde(rename_all = "snake_case")]
1092pub enum MaintenanceUrgency {
1093    /// No maintenance needed
1094    #[default]
1095    None,
1096    /// Routine maintenance
1097    Routine,
1098    /// Soon - schedule maintenance
1099    Soon,
1100    /// Urgent - immediate attention
1101    Urgent,
1102    /// Critical - stop operation
1103    Critical,
1104}
1105
1106#[cfg(test)]
1107mod tests {
1108    use super::*;
1109
1110    #[test]
1111    fn test_event_type_serialization() {
1112        let event_type = EventType::TelemetryPeriodic;
1113        let json = serde_json::to_string(&event_type).unwrap();
1114        assert_eq!(json, "\"telemetry_periodic\"");
1115
1116        let deserialized: EventType = serde_json::from_str(&json).unwrap();
1117        assert_eq!(deserialized, event_type);
1118    }
1119
1120    #[test]
1121    fn test_source_type_serialization() {
1122        let source_type = SourceType::Amr;
1123        let json = serde_json::to_string(&source_type).unwrap();
1124        assert_eq!(json, "\"amr\"");
1125    }
1126
1127    #[test]
1128    fn test_default_values() {
1129        assert_eq!(EventType::default(), EventType::TelemetryPeriodic);
1130        assert_eq!(SourceType::default(), SourceType::Amr);
1131        assert_eq!(OperationalMode::default(), OperationalMode::Autonomous);
1132        assert_eq!(SafetyState::default(), SafetyState::Normal);
1133    }
1134}