gdtf 0.2.0

Tools to read and inspect General Device Type Format (GDTF) files.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
//! Fixture Type Attributes and associated groupings.
//!
//! Note 1: More information on the definitions of attributes can be found in
//! [Annex A](https://gdtf.eu/gdtf/annex/annex-a/) of the GDTF specification.
//!
//! Note 2: All currently defined Fixture Type Attributes, activation groups, and feature groups can
//! be found in [Annex B](https://gdtf.eu/gdtf/annex/annex-b/) of the GDTF specification.

use crate::description::util::IterUtil;
use crate::validation::{ValidationError, ValidationErrorType, ValidationObject, ValidationResult};
use crate::values::{ColorCie, Name, Node, NodeExt};
use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};

/// Defines all Fixture Type Attributes that are used in the [fixture type](super::fixture_type::FixtureType).
///
/// Corresponds to an `<AttributeDefinitions>` XML node.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AttributeDefinitions {
    /// Defines which attributes are to be activated together.
    ///
    /// For example, Pan and Tilt are in the same activation group.
    ///
    /// Corresponds to the `<ActivationGroups>` child XML node.
    #[serde(
        rename = "ActivationGroups",
        skip_serializing_if = "Vec::is_empty",
        serialize_with = "serialize_activation_groups",
        deserialize_with = "deserialize_activation_groups",
        default
    )]
    pub activation_groups: Vec<ActivationGroup>,

    /// Describes the logical grouping of attributes.
    ///
    /// For example, Gobo 1 and Gobo 2 are grouped in the feature Gobo of the feature group Gobo.
    ///
    /// Corresponds to the `<FeatureGroups>` child XML node.
    #[serde(
        rename = "FeatureGroups",
        skip_serializing_if = "Vec::is_empty",
        serialize_with = "serialize_feature_groups",
        deserialize_with = "deserialize_feature_groups"
    )]
    pub feature_groups: Vec<FeatureGroup>,

    /// List of Fixture Type Attributes that are used.
    ///
    /// Corresponds to the `<Attributes>` child XML node.
    #[serde(
        rename = "Attributes",
        skip_serializing_if = "Vec::is_empty",
        serialize_with = "serialize_attributes",
        deserialize_with = "deserialize_attributes"
    )]
    pub attributes: Vec<Attribute>,
}

impl AttributeDefinitions {
    /// Looks up an [ActivationGroup] by [name](ActivationGroup::name).
    pub fn activation_group(&self, name: &str) -> Option<&ActivationGroup> {
        self.activation_groups
            .iter()
            .find(|group| group.name.as_ref().map(Name::as_ref) == Some(name))
    }

    /// Looks up a [FeatureGroup] by [name](FeatureGroup::name).
    pub fn feature_group(&self, name: &str) -> Option<&FeatureGroup> {
        self.feature_groups
            .iter()
            .find(|group| group.name.as_ref().map(Name::as_ref) == Some(name))
    }

    /// Looks up an [Attribute] by [name](Attribute::name).
    pub fn attribute(&self, name: &str) -> Option<&Attribute> {
        self.attributes
            .iter()
            .find(|attribute| attribute.name.as_ref().map(Name::as_ref) == Some(name))
    }

    /// Performs validation checks on the object.
    pub fn validate(&self, result: &mut ValidationResult) {
        let duplicate_activation_group_name = self
            .activation_groups
            .iter()
            .filter_map(|group| group.name.as_ref())
            .find_duplicate();
        if let Some(name) = duplicate_activation_group_name {
            result.errors.push(ValidationError::new(
                ValidationObject::ActivationGroup,
                name.to_string(),
                ValidationErrorType::DuplicateName,
            ));
        }

        let duplicate_feature_group_name = self
            .feature_groups
            .iter()
            .filter_map(|group| group.name.as_ref())
            .find_duplicate();
        if let Some(name) = duplicate_feature_group_name {
            result.errors.push(ValidationError::new(
                ValidationObject::FeatureGroup,
                name.to_string(),
                ValidationErrorType::DuplicateName,
            ));
        }

        let duplicate_attribute_name = self
            .attributes
            .iter()
            .filter_map(|attribute| attribute.name.as_ref())
            .find_duplicate();
        if let Some(name) = duplicate_attribute_name {
            result.errors.push(ValidationError::new(
                ValidationObject::Attribute,
                name.to_string(),
                ValidationErrorType::DuplicateName,
            ));
        }

        for activation_group in &self.activation_groups {
            activation_group.validate(result);
        }

        for feature_group in &self.feature_groups {
            feature_group.validate(result);
        }

        for attribute in &self.attributes {
            attribute.validate(self, result);
        }
    }
}

define_collect_helper!("ActivationGroup" (serialize_activation_groups, deserialize_activation_groups) -> ActivationGroup);

/// Defines groups of Fixture Type Attributes that are intended to be used together.
///
/// Example: Usually Pan and Tilt are Fixture Type Attributes that shall be activated together to
/// be able to store and recreate any position.
///
/// Note: All currently defined activation groups can be found in
/// [Annex B](https://gdtf.eu/gdtf/annex/annex-b/) of the GDTF specification.
///
/// Corresponds to an `<ActivationGroup>` XML node.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ActivationGroup {
    /// The unique name of the activation group.
    ///
    /// Corresponds to the `Name` XML attribute.
    #[serde(rename = "@Name", skip_serializing_if = "Option::is_none")]
    pub name: Option<Name>,
}

impl ActivationGroup {
    /// Performs validation checks on the object.
    pub fn validate(&self, result: &mut ValidationResult) {
        if self.name.is_none() {
            result.errors.push(ValidationError::new(
                ValidationObject::ActivationGroup,
                None,
                ValidationErrorType::MissingName,
            ));
        }
    }
}

define_collect_helper!("FeatureGroup" (serialize_feature_groups, deserialize_feature_groups) -> FeatureGroup);

/// Defines the logical grouping of Fixture Type Attributes.
///
/// Note 1: A feature group can contain more than one logical control unit. A feature group Position
/// shall contain PanTilt and XYZ as separate Features.
///
/// Note 2: Usually Pan and Tilt create a logical unit to enable position control, so they must be
/// grouped in a Feature PanTilt.
///
/// Note 3: All currently defined activation groups can be found in
/// [Annex B](https://gdtf.eu/gdtf/annex/annex-b/) of the GDTF specification.
///
/// Corresponds to a `<FeatureGroup>` XML node.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FeatureGroup {
    /// The unique name of the feature group.
    ///
    /// Corresponds to the `Name` XML attribute.
    #[serde(rename = "@Name", skip_serializing_if = "Option::is_none")]
    pub name: Option<Name>,

    /// The pretty name of the feature group.
    ///
    /// Corresponds to the `Pretty` XML attribute.
    #[serde(rename = "@Pretty")]
    pub pretty: String,

    /// Features contained in the feature group.
    ///
    /// Corresponds to all `<Feature>` child XML nodes.
    #[serde(rename = "Feature", skip_serializing_if = "Vec::is_empty", default)]
    pub features: Vec<Feature>,
}

impl FeatureGroup {
    /// Looks up a [Feature] by [name](Feature::name).
    pub fn feature(&self, name: &str) -> Option<&Feature> {
        self.features
            .iter()
            .find(|feature| feature.name.as_ref().map(|n| n.as_ref()) == Some(name))
    }

    /// Performs validation checks on the object.
    pub fn validate(&self, result: &mut ValidationResult) {
        if self.name.is_none() {
            result.errors.push(ValidationError::new(
                ValidationObject::FeatureGroup,
                None,
                ValidationErrorType::MissingName,
            ));
        }

        let duplicate_feature_name = self
            .features
            .iter()
            .filter_map(|feature| feature.name.as_ref())
            .find_duplicate();
        if let Some(name) = duplicate_feature_name {
            result.errors.push(ValidationError::new(
                ValidationObject::Feature,
                name.to_string(),
                ValidationErrorType::DuplicateName,
            ));
        }

        for feature in &self.features {
            feature.validate(result);
        }
    }
}

/// Defines a feature of a fixture.
///
/// A feature is an element that groups Fixture Type Attributes into a structured way for easier
/// access and search.
///
/// Corresponds to a `<Feature>` XML node.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Feature {
    /// The unique name of the feature.
    ///
    /// Corresponds to the `Name` XML attribute.
    #[serde(rename = "@Name", skip_serializing_if = "Option::is_none")]
    pub name: Option<Name>,
}

impl Feature {
    /// Performs validation checks on the object.
    pub fn validate(&self, result: &mut ValidationResult) {
        if self.name.is_none() {
            result.errors.push(ValidationError::new(
                ValidationObject::Feature,
                None,
                ValidationErrorType::MissingName,
            ));
        }
    }
}

define_collect_helper!("Attribute" (serialize_attributes, deserialize_attributes) -> Attribute);

/// Defines a Fixture Type Attribute.
///
/// An attribute is a singular mutually exclusive control function of a feature, such as Pan or
/// Tilt.
///
/// Definitions of common attributes can be found in [Annex A](https://gdtf.eu/gdtf/annex/annex-a/)
/// of the GDTF specification.
///
/// Corresponds to an `<Attribute>` XML node.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Attribute {
    /// The unique name of the attribute.
    ///
    /// Corresponds to the `Name` XML attribute.
    #[serde(rename = "@Name", skip_serializing_if = "Option::is_none")]
    pub name: Option<Name>,

    /// The pretty name of the attribute.
    ///
    /// Corresponds to the `Pretty` XML attribute.
    #[serde(rename = "@Pretty")]
    pub pretty: String,

    /// Optional link to an [ActivationGroup].
    ///
    /// The link is relative to the parent [AttributeDefinitions] object.
    ///
    /// See the [Attribute::activation_group] method to look up the linked activation group.
    ///
    /// Corresponds to the `ActivationGroup` XML attribute.
    #[serde(rename = "@ActivationGroup", skip_serializing_if = "Option::is_none")]
    pub activation_group: Option<Node>,

    /// Link to the corresponding [Feature].
    ///
    /// The link is relative to the parent [AttributeDefinitions] object.
    ///
    /// See the [Attribute::feature] method to look up the linked feature.
    ///
    /// Corresponds to the `Feature` XML attribute.
    #[serde(rename = "@Feature")]
    pub feature: Option<Node>,

    /// Optional link to the main [Attribute].
    ///
    /// The link is relative to the parent [AttributeDefinitions] object.
    ///
    /// See the [Attribute::main_attribute] method to look up the linked attribute.
    ///
    /// Corresponds to the `MainAttribute` XML attribute.
    #[serde(rename = "@MainAttribute", skip_serializing_if = "Option::is_none")]
    pub main_attribute: Option<Node>,

    /// The physical unit values of the attribute are measured in.
    ///
    /// Corresponds to the `PhysicalUnit` XML attribute.
    #[serde(rename = "@PhysicalUnit")]
    pub physical_unit: PhysicalUnit,

    /// An optional color for the attribute.
    ///
    /// Corresponds to the `Color` XML attribute.
    #[serde(rename = "@Color", skip_serializing_if = "Option::is_none")]
    pub color: Option<ColorCie>,

    /// A list of sub physical units belonging to the attribute.
    ///
    /// Sub physical units define how the attribute controls special aspects of the physical
    /// fixture, such as the offset of an individual gobo or the duty cycle of a strobing shutter.
    ///
    /// Corresponds to all `<SubPhysicalUnit>` XML child nodes.
    #[serde(
        rename = "SubPhysicalUnit",
        skip_serializing_if = "Vec::is_empty",
        default
    )]
    pub subphysical_units: Vec<SubPhysicalUnit>,
}

impl Attribute {
    /// Looks up the optional [ActivationGroup] linked by this attribute.
    pub fn activation_group<'s>(
        &self,
        parent_attribute_definitions: &'s AttributeDefinitions,
    ) -> Option<&'s ActivationGroup> {
        let name = self.activation_group.as_ref()?.single()?;
        parent_attribute_definitions.activation_group(name)
    }

    /// Looks up the corresponding [Feature] linked by this attribute.
    pub fn feature<'s>(
        &self,
        parent_attribute_definitions: &'s AttributeDefinitions,
    ) -> Option<&'s Feature> {
        let (group_name, tail) = self.feature.as_ref()?.split_first()?;
        let feat_name = tail.single()?;
        parent_attribute_definitions
            .feature_group(group_name)?
            .feature(feat_name)
    }

    /// Looks up the optional main [Attribute] linked by this attribute.
    pub fn main_attribute<'s>(
        &self,
        parent_attribute_definitions: &'s AttributeDefinitions,
    ) -> Option<&'s Attribute> {
        let name = self.main_attribute.as_ref()?.single()?;
        parent_attribute_definitions.attribute(name)
    }

    /// Performs validation checks on the object.
    pub fn validate(
        &self,
        parent_attribute_definitions: &AttributeDefinitions,
        result: &mut ValidationResult,
    ) {
        if self.name.is_none() {
            result.errors.push(ValidationError::new(
                ValidationObject::Attribute,
                None,
                ValidationErrorType::MissingName,
            ));
        }

        let name = self.name.as_ref();

        if let (Some(activation_group), None) = (
            &self.activation_group,
            self.activation_group(parent_attribute_definitions),
        ) {
            result.errors.push(ValidationError::new(
                ValidationObject::Attribute,
                name.map(Name::to_string),
                ValidationErrorType::LinkNotFound(
                    ValidationObject::ActivationGroup,
                    activation_group.clone(),
                ),
            ));
        }

        if let (Some(feature), None) = (&self.feature, self.feature(parent_attribute_definitions)) {
            result.errors.push(ValidationError::new(
                ValidationObject::Attribute,
                name.map(Name::to_string),
                ValidationErrorType::LinkNotFound(ValidationObject::Feature, feature.clone()),
            ));
        }

        if let (Some(main_attribute), None) = (
            &self.main_attribute,
            self.main_attribute(parent_attribute_definitions),
        ) {
            result.errors.push(ValidationError::new(
                ValidationObject::Attribute,
                name.map(Name::to_string),
                ValidationErrorType::LinkNotFound(
                    ValidationObject::Attribute,
                    main_attribute.clone(),
                ),
            ));
        }

        let duplicate_sub_physical_type = self
            .subphysical_units
            .iter()
            .map(|unit| unit.type_)
            .find_duplicate();
        if let Some(sub_physical_unit_type) = duplicate_sub_physical_type {
            result.errors.push(ValidationError::new(
                ValidationObject::Attribute,
                name.map(Name::to_string),
                ValidationErrorType::DuplicateSubPhysicalUnit(sub_physical_unit_type),
            ));
        }
    }
}

/// Describes how an attribute relates to a sub physical unit of a fixture.
///
/// Sub physical units define how the attribute controls special aspects of the physical
/// fixture, such as the offset of an individual gobo or the duty cycle of a strobing shutter.
///
/// Corresponds to a `<SubPhysicalUnit>` XML node.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SubPhysicalUnit {
    /// The type of sub physical unit.
    ///
    /// Corresponds to the `Type` XML attribute.
    #[serde(rename = "@Type")]
    pub type_: SubPhysicalUnitType,

    /// The physical unit values of the unit are measured in.
    ///
    /// Corresponds to the `PhysicalUnit` XML attribute.
    #[serde(rename = "@PhysicalUnit", default)]
    pub physical_unit: PhysicalUnit,

    /// The default physical from of the subphysical unit.
    ///
    /// Corresponds to the `PhysicalFrom` XML attribute.
    #[serde(rename = "@PhysicalFrom", default = "physical_from_default")]
    pub physical_from: f64,

    /// The default physical to of the subphysical unit.
    ///
    /// Corresponds to the `PhysicalTo` XML attribute.
    #[serde(rename = "@PhysicalTo", default = "physical_to_default")]
    pub physical_to: f64,
}

/// Valid types of a [SubPhysicalUnit].
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub enum SubPhysicalUnitType {
    /// Defines the offset of the selected wheel slot in degrees.
    ///
    /// Defined for attributes: `Gobo(n)`, `Gobo(n)SelectSpin`, `Gobo(n)SelectShake`,
    /// `Gobo(n)WheelIndex`, `Gobo(n)WheelSpin`, `Gobo(n)WheelShake`, `Gobo(n)WheelRandom`,
    /// `Gobo(n)WheelAudio`, `AnimationWheel(n)`, `AnimationWheel(n)Audio`,
    /// `AnimationWheel(n)Random`, `AnimationWheel(n)SelectShake`, `AnimationWheel(n)SelectSpin`,
    /// `Color(n)`, `Color(n)WheelIndex`, `Color(n)WheelSpin`, `Color(n)WheelRandom`,
    /// `Color(n)WheelAudio`.
    PlacementOffset,

    /// Defines the peak amplitude of an effect as a percentage of the size.
    ///
    /// Defined for attributes: `Gobo(n)SelectShake`, `Gobo(n)WheelShake`, `Gobo(n)PosShake`,
    /// `AnimationWheel(n)SelectShake`, `AnimationWheel(n)PosShake`, `AnimationSystem(n)PosShake`.
    Amplitude,

    /// Defines the minimum position in relation to the whole way of the spline.
    ///
    /// Defined for attributes: `AnimationSystem(n)Ramp`, `AnimationSystem(n)Shake`.
    AmplitudeMin,

    /// Defines the maximum position in relation to the whole way of the spline.
    ///
    /// Defined for attributes: `AnimationSystem(n)Ramp`, `AnimationSystem(n)Shake`.
    AmplitudeMax,

    /// Defines the duration of the on time of the effect.
    ///
    /// Defined for attributes: `Shutter(n)Strobe`, `Shutter(n)StrobeRandom`, `IrisStrobe`,
    /// `IrisStrobeRandom`.
    Duration,

    /// Defines the duration percentage of one period in which the effect is on.
    ///
    /// Defined for attributes: `AnimationSystem(n)Ramp`, `Shutter(n)StrobePulse`,
    /// `Shutter(n)StrobePulseClose`, `Shutter(n)StrobePulseOpen`, `IrisPulseClose`,
    /// `IrisPulseOpen`, `Frost(n)PulseOpen`, `Frost(n)PulseClose`, `Frost(n)Ramp`.
    DutyCycle,

    /// Defines the offset of the end of the end of the effect from the start as a percentage of the
    /// total period.
    ///
    /// Defined for attributes: `Shutter(n)Strobe`, `Shutter(n)StrobePulse`,
    /// `Shutter(n)StrobePulseClose`, `Shutter(n)StrobePulseOpen`, `IrisStrobe`, `IrisPulseClose`,
    /// `IrisPulseOpen`, `Frost(n)PulseOpen`, `Frost(n)PulseClose`, `Frost(n)Ramp`.
    TimeOffset,

    /// Defines the minimum percentage to which the iris closes.
    ///
    /// Defined for attributes: `IrisStrobe`, `IrisStrobeRandom`, `IrisPulseClose`, `IrisPulseOpen`,
    /// `IrisRandomPulseClose`, `IrisRandomPulseOpen`.
    MinimumOpening,

    /// No defined behaviour.
    Value,

    /// Defines the size of the beam compared to the original size.
    ///
    /// Defined for attributes: `BeamShaper`.
    RatioHorizontal,

    /// Defines the size of the beam compared to the original size.
    ///
    /// Defined for attributes: `BeamShaper`.
    RatioVertical,
}

impl SubPhysicalUnitType {
    /// Returns a string representation of the unit type.
    pub fn as_str(self) -> &'static str {
        match self {
            SubPhysicalUnitType::PlacementOffset => "PlacementOffset",
            SubPhysicalUnitType::Amplitude => "Amplitude",
            SubPhysicalUnitType::AmplitudeMin => "AmplitudeMin",
            SubPhysicalUnitType::AmplitudeMax => "AmplitudeMax",
            SubPhysicalUnitType::Duration => "Duration",
            SubPhysicalUnitType::DutyCycle => "DutyCycle",
            SubPhysicalUnitType::TimeOffset => "TimeOffset",
            SubPhysicalUnitType::MinimumOpening => "MinimumOpening",
            SubPhysicalUnitType::Value => "Value",
            SubPhysicalUnitType::RatioHorizontal => "RatioHorizontal",
            SubPhysicalUnitType::RatioVertical => "RatioVertical",
        }
    }
}

impl Display for SubPhysicalUnitType {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        self.serialize(f)
    }
}

fn physical_from_default() -> f64 {
    0.
}
fn physical_to_default() -> f64 {
    1.
}

/// A measure of physical quantity.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Default, Serialize, Deserialize)]
pub enum PhysicalUnit {
    /// Measured in percentage (%).
    Percent,

    /// Measured in meters (m).
    Length,

    /// Measured in kilograms (kg).
    Mass,

    /// Measured in seconds (s).
    Time,

    /// Measured in kelvin (K).
    Temperature,

    /// Measured in candela (cd).
    LuminousIntensity,

    /// Measured in degrees.
    Angle,

    /// Measured in newtons (N).
    Force,

    /// Measured in hertz (Hz).
    Frequency,

    /// Measured in amps (A).
    Current,

    /// Measured in voltage (V).
    Voltage,

    /// Measured in watts (W).
    Power,

    /// Measured in joules (J).
    Energy,

    /// Measured in meters squared (m2).
    Area,

    /// Measured in meters cubed (m3).
    Volume,

    /// Measured in meters per second (m/s).
    Speed,

    /// Measured in meters per second per second (m/s2).
    Acceleration,

    /// Measured in degrees per second (degree/s).
    AngularSpeed,

    /// Measured in degrees per second per second (degree/s2).
    AngularAccc,

    /// Measured in nanometers (nm).
    WaveLength,

    /// Measured as abstract intensity of a color from 0-1.
    ColorComponent,

    /// No physical unit.
    #[default]
    #[serde(other)]
    None,
}