Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

kicad_monkey_contracts/generated/
compiled_schematic_graph.rs

1/// Error types.
2pub mod error {
3    /// Error from a `TryFrom` or `FromStr` implementation.
4    pub struct ConversionError(::std::borrow::Cow<'static, str>);
5    impl ::std::error::Error for ConversionError {}
6    impl ::std::fmt::Display for ConversionError {
7        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
8            ::std::fmt::Display::fmt(&self.0, f)
9        }
10    }
11    impl ::std::fmt::Debug for ConversionError {
12        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
13            ::std::fmt::Debug::fmt(&self.0, f)
14        }
15    }
16    impl From<&'static str> for ConversionError {
17        fn from(value: &'static str) -> Self {
18            Self(value.into())
19        }
20    }
21    impl From<String> for ConversionError {
22        fn from(value: String) -> Self {
23            Self(value.into())
24        }
25    }
26}
27///Complete variant-neutral schematic occurrence and connectivity graph.
28///
29/// <details><summary>JSON schema</summary>
30///
31/// ```json
32///{
33///  "$id": "urn:wavenumber:schema:kicad_monkey.compiled_schematic_graph:a0",
34///  "title": "Compiled schematic graph a0",
35///  "description": "Complete variant-neutral schematic occurrence and connectivity graph.",
36///  "type": "object",
37///  "required": [
38///    "component_occurrences",
39///    "graphical_artifact_links",
40///    "hierarchy_occurrences",
41///    "hierarchy_terminal_bindings",
42///    "identity_namespace",
43///    "local_net_occurrences",
44///    "page_definitions",
45///    "page_occurrences",
46///    "schema",
47///    "terminal_occurrences",
48///    "type",
49///    "unit_definitions",
50///    "unit_occurrences"
51///  ],
52///  "properties": {
53///    "component_occurrences": {
54///      "type": "array",
55///      "items": {
56///        "$ref": "#/$defs/ComponentOccurrence"
57///      }
58///    },
59///    "graphical_artifact_links": {
60///      "type": "array",
61///      "items": {
62///        "$ref": "#/$defs/GraphicalArtifactLink"
63///      }
64///    },
65///    "hierarchy_occurrences": {
66///      "type": "array",
67///      "items": {
68///        "$ref": "#/$defs/HierarchyOccurrence"
69///      }
70///    },
71///    "hierarchy_terminal_bindings": {
72///      "type": "array",
73///      "items": {
74///        "$ref": "#/$defs/HierarchyTerminalBinding"
75///      }
76///    },
77///    "identity_namespace": {
78///      "type": "string",
79///      "const": "sch.compiled_schematic_graph.a0"
80///    },
81///    "local_net_occurrences": {
82///      "type": "array",
83///      "items": {
84///        "$ref": "#/$defs/LocalNetOccurrence"
85///      }
86///    },
87///    "page_definitions": {
88///      "type": "array",
89///      "items": {
90///        "$ref": "#/$defs/PageDefinition"
91///      }
92///    },
93///    "page_occurrences": {
94///      "type": "array",
95///      "items": {
96///        "$ref": "#/$defs/PageOccurrence"
97///      }
98///    },
99///    "schema": {
100///      "type": "string",
101///      "const": "kicad_monkey.compiled_schematic_graph.a0"
102///    },
103///    "terminal_occurrences": {
104///      "type": "array",
105///      "items": {
106///        "$ref": "#/$defs/TerminalOccurrence"
107///      }
108///    },
109///    "type": {
110///      "type": "string",
111///      "const": "sch.compiled_schematic_graph"
112///    },
113///    "unit_definitions": {
114///      "type": "array",
115///      "items": {
116///        "$ref": "#/$defs/UnitDefinition"
117///      }
118///    },
119///    "unit_occurrences": {
120///      "type": "array",
121///      "items": {
122///        "$ref": "#/$defs/UnitOccurrence"
123///      }
124///    }
125///  },
126///  "additionalProperties": false
127///}
128/// ```
129/// </details>
130#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
131#[serde(deny_unknown_fields)]
132pub struct CompiledSchematicGraphA0 {
133    pub component_occurrences: ::std::vec::Vec<ComponentOccurrence>,
134    pub graphical_artifact_links: ::std::vec::Vec<GraphicalArtifactLink>,
135    pub hierarchy_occurrences: ::std::vec::Vec<HierarchyOccurrence>,
136    pub hierarchy_terminal_bindings: ::std::vec::Vec<HierarchyTerminalBinding>,
137    pub identity_namespace: ::std::string::String,
138    pub local_net_occurrences: ::std::vec::Vec<LocalNetOccurrence>,
139    pub page_definitions: ::std::vec::Vec<PageDefinition>,
140    pub page_occurrences: ::std::vec::Vec<PageOccurrence>,
141    pub schema: ::std::string::String,
142    pub terminal_occurrences: ::std::vec::Vec<TerminalOccurrence>,
143    #[serde(rename = "type")]
144    pub type_: ::std::string::String,
145    pub unit_definitions: ::std::vec::Vec<UnitDefinition>,
146    pub unit_occurrences: ::std::vec::Vec<UnitOccurrence>,
147}
148///`ComponentOccurrence`
149///
150/// <details><summary>JSON schema</summary>
151///
152/// ```json
153///{
154///  "type": "object",
155///  "required": [
156///    "body_style",
157///    "display_designator",
158///    "id",
159///    "page_occurrence_ref",
160///    "physical_designator",
161///    "source_designator",
162///    "source_identity",
163///    "type",
164///    "unit"
165///  ],
166///  "properties": {
167///    "body_style": {
168///      "type": "integer",
169///      "maximum": 4294967295.0,
170///      "minimum": 0.0
171///    },
172///    "design_component_ref": {
173///      "type": "string"
174///    },
175///    "display_designator": {
176///      "type": "string"
177///    },
178///    "id": {
179///      "type": "string"
180///    },
181///    "page_occurrence_ref": {
182///      "type": "string"
183///    },
184///    "physical_designator": {
185///      "type": "string"
186///    },
187///    "source_designator": {
188///      "type": "string"
189///    },
190///    "source_identity": {
191///      "$ref": "#/$defs/SourceIdentity"
192///    },
193///    "type": {
194///      "type": "string",
195///      "const": "sch.component_occurrence"
196///    },
197///    "unit": {
198///      "type": "integer",
199///      "maximum": 4294967295.0,
200///      "minimum": 1.0
201///    }
202///  },
203///  "additionalProperties": false
204///}
205/// ```
206/// </details>
207#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
208#[serde(deny_unknown_fields)]
209pub struct ComponentOccurrence {
210    pub body_style: u32,
211    #[serde(
212        default,
213        deserialize_with = "crate::deserialize_present_nonnull",
214        skip_serializing_if = "::std::option::Option::is_none"
215    )]
216    pub design_component_ref: ::std::option::Option<::std::string::String>,
217    pub display_designator: ::std::string::String,
218    pub id: ::std::string::String,
219    pub page_occurrence_ref: ::std::string::String,
220    pub physical_designator: ::std::string::String,
221    pub source_designator: ::std::string::String,
222    pub source_identity: SourceIdentity,
223    #[serde(rename = "type")]
224    pub type_: ::std::string::String,
225    pub unit: ::std::num::NonZeroU64,
226}
227///`GraphicalArtifactLink`
228///
229/// <details><summary>JSON schema</summary>
230///
231/// ```json
232///{
233///  "type": "object",
234///  "required": [
235///    "artifact_key",
236///    "element_id",
237///    "id",
238///    "page_occurrence_ref",
239///    "source_identity",
240///    "target_ref",
241///    "target_type",
242///    "type"
243///  ],
244///  "properties": {
245///    "artifact_key": {
246///      "type": "string",
247///      "const": "sch.dwg_scene"
248///    },
249///    "element_id": {
250///      "type": "string"
251///    },
252///    "id": {
253///      "type": "string"
254///    },
255///    "page_occurrence_ref": {
256///      "type": "string"
257///    },
258///    "source_identity": {
259///      "$ref": "#/$defs/SourceIdentity"
260///    },
261///    "target_ref": {
262///      "type": "string"
263///    },
264///    "target_type": {
265///      "$ref": "#/$defs/GraphicalTargetType"
266///    },
267///    "type": {
268///      "type": "string",
269///      "const": "sch.graphical_artifact_link"
270///    }
271///  },
272///  "additionalProperties": false
273///}
274/// ```
275/// </details>
276#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
277#[serde(deny_unknown_fields)]
278pub struct GraphicalArtifactLink {
279    pub artifact_key: ::std::string::String,
280    pub element_id: ::std::string::String,
281    pub id: ::std::string::String,
282    pub page_occurrence_ref: ::std::string::String,
283    pub source_identity: SourceIdentity,
284    pub target_ref: ::std::string::String,
285    pub target_type: GraphicalTargetType,
286    #[serde(rename = "type")]
287    pub type_: ::std::string::String,
288}
289///`GraphicalTargetType`
290///
291/// <details><summary>JSON schema</summary>
292///
293/// ```json
294///{
295///  "type": "string",
296///  "enum": [
297///    "sch.component_occurrence",
298///    "sch.hierarchy_occurrence",
299///    "sch.terminal_occurrence",
300///    "sch.local_net_occurrence",
301///    "sch.page_occurrence"
302///  ]
303///}
304/// ```
305/// </details>
306#[derive(
307    ::serde::Deserialize,
308    ::serde::Serialize,
309    Clone,
310    Copy,
311    Debug,
312    Eq,
313    Hash,
314    Ord,
315    PartialEq,
316    PartialOrd,
317)]
318pub enum GraphicalTargetType {
319    #[serde(rename = "sch.component_occurrence")]
320    SchComponentOccurrence,
321    #[serde(rename = "sch.hierarchy_occurrence")]
322    SchHierarchyOccurrence,
323    #[serde(rename = "sch.terminal_occurrence")]
324    SchTerminalOccurrence,
325    #[serde(rename = "sch.local_net_occurrence")]
326    SchLocalNetOccurrence,
327    #[serde(rename = "sch.page_occurrence")]
328    SchPageOccurrence,
329}
330impl ::std::fmt::Display for GraphicalTargetType {
331    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
332        match *self {
333            Self::SchComponentOccurrence => f.write_str("sch.component_occurrence"),
334            Self::SchHierarchyOccurrence => f.write_str("sch.hierarchy_occurrence"),
335            Self::SchTerminalOccurrence => f.write_str("sch.terminal_occurrence"),
336            Self::SchLocalNetOccurrence => f.write_str("sch.local_net_occurrence"),
337            Self::SchPageOccurrence => f.write_str("sch.page_occurrence"),
338        }
339    }
340}
341impl ::std::str::FromStr for GraphicalTargetType {
342    type Err = self::error::ConversionError;
343    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
344        match value {
345            "sch.component_occurrence" => Ok(Self::SchComponentOccurrence),
346            "sch.hierarchy_occurrence" => Ok(Self::SchHierarchyOccurrence),
347            "sch.terminal_occurrence" => Ok(Self::SchTerminalOccurrence),
348            "sch.local_net_occurrence" => Ok(Self::SchLocalNetOccurrence),
349            "sch.page_occurrence" => Ok(Self::SchPageOccurrence),
350            _ => Err("invalid value".into()),
351        }
352    }
353}
354impl ::std::convert::TryFrom<&str> for GraphicalTargetType {
355    type Error = self::error::ConversionError;
356    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
357        value.parse()
358    }
359}
360impl ::std::convert::TryFrom<&::std::string::String> for GraphicalTargetType {
361    type Error = self::error::ConversionError;
362    fn try_from(
363        value: &::std::string::String,
364    ) -> ::std::result::Result<Self, self::error::ConversionError> {
365        value.parse()
366    }
367}
368impl ::std::convert::TryFrom<::std::string::String> for GraphicalTargetType {
369    type Error = self::error::ConversionError;
370    fn try_from(
371        value: ::std::string::String,
372    ) -> ::std::result::Result<Self, self::error::ConversionError> {
373        value.parse()
374    }
375}
376///`HierarchyOccurrence`
377///
378/// <details><summary>JSON schema</summary>
379///
380/// ```json
381///{
382///  "type": "object",
383///  "required": [
384///    "child_unit_occurrence_ref",
385///    "id",
386///    "parent_page_occurrence_ref",
387///    "parent_unit_occurrence_ref",
388///    "source_identity",
389///    "type"
390///  ],
391///  "properties": {
392///    "child_unit_occurrence_ref": {
393///      "type": "string"
394///    },
395///    "id": {
396///      "type": "string"
397///    },
398///    "parent_page_occurrence_ref": {
399///      "type": "string"
400///    },
401///    "parent_unit_occurrence_ref": {
402///      "type": "string"
403///    },
404///    "source_identity": {
405///      "$ref": "#/$defs/SourceIdentity"
406///    },
407///    "type": {
408///      "type": "string",
409///      "const": "sch.hierarchy_occurrence"
410///    }
411///  },
412///  "additionalProperties": false
413///}
414/// ```
415/// </details>
416#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
417#[serde(deny_unknown_fields)]
418pub struct HierarchyOccurrence {
419    pub child_unit_occurrence_ref: ::std::string::String,
420    pub id: ::std::string::String,
421    pub parent_page_occurrence_ref: ::std::string::String,
422    pub parent_unit_occurrence_ref: ::std::string::String,
423    pub source_identity: SourceIdentity,
424    #[serde(rename = "type")]
425    pub type_: ::std::string::String,
426}
427///`HierarchyTerminalBinding`
428///
429/// <details><summary>JSON schema</summary>
430///
431/// ```json
432///{
433///  "type": "object",
434///  "required": [
435///    "child_terminal_occurrence_ref",
436///    "hierarchy_occurrence_ref",
437///    "id",
438///    "parent_terminal_occurrence_ref",
439///    "source_identity",
440///    "type"
441///  ],
442///  "properties": {
443///    "child_terminal_occurrence_ref": {
444///      "type": "string"
445///    },
446///    "design_net_ref": {
447///      "type": "string"
448///    },
449///    "hierarchy_occurrence_ref": {
450///      "type": "string"
451///    },
452///    "id": {
453///      "type": "string"
454///    },
455///    "parent_terminal_occurrence_ref": {
456///      "type": "string"
457///    },
458///    "source_identity": {
459///      "$ref": "#/$defs/SourceIdentity"
460///    },
461///    "type": {
462///      "type": "string",
463///      "const": "sch.hierarchy_terminal_binding"
464///    }
465///  },
466///  "additionalProperties": false
467///}
468/// ```
469/// </details>
470#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
471#[serde(deny_unknown_fields)]
472pub struct HierarchyTerminalBinding {
473    pub child_terminal_occurrence_ref: ::std::string::String,
474    #[serde(
475        default,
476        deserialize_with = "crate::deserialize_present_nonnull",
477        skip_serializing_if = "::std::option::Option::is_none"
478    )]
479    pub design_net_ref: ::std::option::Option<::std::string::String>,
480    pub hierarchy_occurrence_ref: ::std::string::String,
481    pub id: ::std::string::String,
482    pub parent_terminal_occurrence_ref: ::std::string::String,
483    pub source_identity: SourceIdentity,
484    #[serde(rename = "type")]
485    pub type_: ::std::string::String,
486}
487///`LocalNetOccurrence`
488///
489/// <details><summary>JSON schema</summary>
490///
491/// ```json
492///{
493///  "type": "object",
494///  "required": [
495///    "aliases",
496///    "display_name",
497///    "id",
498///    "page_occurrence_ref",
499///    "source_identity",
500///    "type"
501///  ],
502///  "properties": {
503///    "aliases": {
504///      "type": "array",
505///      "items": {
506///        "type": "string"
507///      }
508///    },
509///    "design_net_ref": {
510///      "type": "string"
511///    },
512///    "display_name": {
513///      "type": "string"
514///    },
515///    "id": {
516///      "type": "string"
517///    },
518///    "page_occurrence_ref": {
519///      "type": "string"
520///    },
521///    "qualified_name": {
522///      "type": "string"
523///    },
524///    "source_identity": {
525///      "$ref": "#/$defs/SourceIdentity"
526///    },
527///    "type": {
528///      "type": "string",
529///      "const": "sch.local_net_occurrence"
530///    }
531///  },
532///  "additionalProperties": false
533///}
534/// ```
535/// </details>
536#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
537#[serde(deny_unknown_fields)]
538pub struct LocalNetOccurrence {
539    pub aliases: ::std::vec::Vec<::std::string::String>,
540    #[serde(
541        default,
542        deserialize_with = "crate::deserialize_present_nonnull",
543        skip_serializing_if = "::std::option::Option::is_none"
544    )]
545    pub design_net_ref: ::std::option::Option<::std::string::String>,
546    pub display_name: ::std::string::String,
547    pub id: ::std::string::String,
548    pub page_occurrence_ref: ::std::string::String,
549    #[serde(
550        default,
551        deserialize_with = "crate::deserialize_present_nonnull",
552        skip_serializing_if = "::std::option::Option::is_none"
553    )]
554    pub qualified_name: ::std::option::Option<::std::string::String>,
555    pub source_identity: SourceIdentity,
556    #[serde(rename = "type")]
557    pub type_: ::std::string::String,
558}
559///`PageDefinition`
560///
561/// <details><summary>JSON schema</summary>
562///
563/// ```json
564///{
565///  "type": "object",
566///  "required": [
567///    "display_name",
568///    "id",
569///    "source_identity",
570///    "type",
571///    "unit_definition_ref"
572///  ],
573///  "properties": {
574///    "display_name": {
575///      "type": "string"
576///    },
577///    "id": {
578///      "type": "string"
579///    },
580///    "source_identity": {
581///      "$ref": "#/$defs/SourceIdentity"
582///    },
583///    "type": {
584///      "type": "string",
585///      "const": "sch.page_definition"
586///    },
587///    "unit_definition_ref": {
588///      "type": "string"
589///    }
590///  },
591///  "additionalProperties": false
592///}
593/// ```
594/// </details>
595#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
596#[serde(deny_unknown_fields)]
597pub struct PageDefinition {
598    pub display_name: ::std::string::String,
599    pub id: ::std::string::String,
600    pub source_identity: SourceIdentity,
601    #[serde(rename = "type")]
602    pub type_: ::std::string::String,
603    pub unit_definition_ref: ::std::string::String,
604}
605///`PageOccurrence`
606///
607/// <details><summary>JSON schema</summary>
608///
609/// ```json
610///{
611///  "type": "object",
612///  "required": [
613///    "display_name",
614///    "id",
615///    "instance_order",
616///    "page_definition_ref",
617///    "source_identity",
618///    "type",
619///    "unit_occurrence_ref"
620///  ],
621///  "properties": {
622///    "address_key": {
623///      "type": "string"
624///    },
625///    "display_name": {
626///      "type": "string"
627///    },
628///    "id": {
629///      "type": "string"
630///    },
631///    "instance_order": {
632///      "type": "integer",
633///      "maximum": 4294967295.0,
634///      "minimum": 0.0
635///    },
636///    "page_definition_ref": {
637///      "type": "string"
638///    },
639///    "sheet_number": {
640///      "type": "string"
641///    },
642///    "source_identity": {
643///      "$ref": "#/$defs/SourceIdentity"
644///    },
645///    "type": {
646///      "type": "string",
647///      "const": "sch.page_occurrence"
648///    },
649///    "unit_occurrence_ref": {
650///      "type": "string"
651///    }
652///  },
653///  "additionalProperties": false
654///}
655/// ```
656/// </details>
657#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
658#[serde(deny_unknown_fields)]
659pub struct PageOccurrence {
660    #[serde(
661        default,
662        deserialize_with = "crate::deserialize_present_nonnull",
663        skip_serializing_if = "::std::option::Option::is_none"
664    )]
665    pub address_key: ::std::option::Option<::std::string::String>,
666    pub display_name: ::std::string::String,
667    pub id: ::std::string::String,
668    pub instance_order: u32,
669    pub page_definition_ref: ::std::string::String,
670    #[serde(
671        default,
672        deserialize_with = "crate::deserialize_present_nonnull",
673        skip_serializing_if = "::std::option::Option::is_none"
674    )]
675    pub sheet_number: ::std::option::Option<::std::string::String>,
676    pub source_identity: SourceIdentity,
677    #[serde(rename = "type")]
678    pub type_: ::std::string::String,
679    pub unit_occurrence_ref: ::std::string::String,
680}
681///`ResolutionDiagnostic`
682///
683/// <details><summary>JSON schema</summary>
684///
685/// ```json
686///{
687///  "type": "string",
688///  "enum": [
689///    "logical_pin_unresolved",
690///    "component_occurrence_unresolved",
691///    "hierarchy_terminal_binding_unresolved",
692///    "design_net_unresolved"
693///  ]
694///}
695/// ```
696/// </details>
697#[derive(
698    ::serde::Deserialize,
699    ::serde::Serialize,
700    Clone,
701    Copy,
702    Debug,
703    Eq,
704    Hash,
705    Ord,
706    PartialEq,
707    PartialOrd,
708)]
709pub enum ResolutionDiagnostic {
710    #[serde(rename = "logical_pin_unresolved")]
711    LogicalPinUnresolved,
712    #[serde(rename = "component_occurrence_unresolved")]
713    ComponentOccurrenceUnresolved,
714    #[serde(rename = "hierarchy_terminal_binding_unresolved")]
715    HierarchyTerminalBindingUnresolved,
716    #[serde(rename = "design_net_unresolved")]
717    DesignNetUnresolved,
718}
719impl ::std::fmt::Display for ResolutionDiagnostic {
720    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
721        match *self {
722            Self::LogicalPinUnresolved => f.write_str("logical_pin_unresolved"),
723            Self::ComponentOccurrenceUnresolved => f.write_str("component_occurrence_unresolved"),
724            Self::HierarchyTerminalBindingUnresolved => {
725                f.write_str("hierarchy_terminal_binding_unresolved")
726            }
727            Self::DesignNetUnresolved => f.write_str("design_net_unresolved"),
728        }
729    }
730}
731impl ::std::str::FromStr for ResolutionDiagnostic {
732    type Err = self::error::ConversionError;
733    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
734        match value {
735            "logical_pin_unresolved" => Ok(Self::LogicalPinUnresolved),
736            "component_occurrence_unresolved" => Ok(Self::ComponentOccurrenceUnresolved),
737            "hierarchy_terminal_binding_unresolved" => Ok(Self::HierarchyTerminalBindingUnresolved),
738            "design_net_unresolved" => Ok(Self::DesignNetUnresolved),
739            _ => Err("invalid value".into()),
740        }
741    }
742}
743impl ::std::convert::TryFrom<&str> for ResolutionDiagnostic {
744    type Error = self::error::ConversionError;
745    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
746        value.parse()
747    }
748}
749impl ::std::convert::TryFrom<&::std::string::String> for ResolutionDiagnostic {
750    type Error = self::error::ConversionError;
751    fn try_from(
752        value: &::std::string::String,
753    ) -> ::std::result::Result<Self, self::error::ConversionError> {
754        value.parse()
755    }
756}
757impl ::std::convert::TryFrom<::std::string::String> for ResolutionDiagnostic {
758    type Error = self::error::ConversionError;
759    fn try_from(
760        value: ::std::string::String,
761    ) -> ::std::result::Result<Self, self::error::ConversionError> {
762        value.parse()
763    }
764}
765///Registered producer provenance retained for importer replay and diagnostics.
766///
767/// <details><summary>JSON schema</summary>
768///
769/// ```json
770///{
771///  "description": "Registered producer provenance retained for importer replay and diagnostics.",
772///  "type": "object",
773///  "properties": {
774///    "sch.source_key.artifact_element": {
775///      "type": "string"
776///    },
777///    "sch.source_key.compiled_net": {
778///      "type": "string"
779///    },
780///    "sch.source_key.source_path": {
781///      "type": "string"
782///    },
783///    "sch.source_key.source_record": {
784///      "type": "string"
785///    },
786///    "sch.source_key.source_subobject": {
787///      "type": "string"
788///    },
789///    "sch.source_key.source_uuid": {
790///      "type": "string"
791///    }
792///  },
793///  "additionalProperties": false
794///}
795/// ```
796/// </details>
797#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
798#[serde(deny_unknown_fields)]
799pub struct SourceIdentity {
800    #[serde(
801        rename = "sch.source_key.artifact_element",
802        default,
803        deserialize_with = "crate::deserialize_present_nonnull",
804        skip_serializing_if = "::std::option::Option::is_none"
805    )]
806    pub sch_source_key_artifact_element: ::std::option::Option<::std::string::String>,
807    #[serde(
808        rename = "sch.source_key.compiled_net",
809        default,
810        deserialize_with = "crate::deserialize_present_nonnull",
811        skip_serializing_if = "::std::option::Option::is_none"
812    )]
813    pub sch_source_key_compiled_net: ::std::option::Option<::std::string::String>,
814    #[serde(
815        rename = "sch.source_key.source_path",
816        default,
817        deserialize_with = "crate::deserialize_present_nonnull",
818        skip_serializing_if = "::std::option::Option::is_none"
819    )]
820    pub sch_source_key_source_path: ::std::option::Option<::std::string::String>,
821    #[serde(
822        rename = "sch.source_key.source_record",
823        default,
824        deserialize_with = "crate::deserialize_present_nonnull",
825        skip_serializing_if = "::std::option::Option::is_none"
826    )]
827    pub sch_source_key_source_record: ::std::option::Option<::std::string::String>,
828    #[serde(
829        rename = "sch.source_key.source_subobject",
830        default,
831        deserialize_with = "crate::deserialize_present_nonnull",
832        skip_serializing_if = "::std::option::Option::is_none"
833    )]
834    pub sch_source_key_source_subobject: ::std::option::Option<::std::string::String>,
835    #[serde(
836        rename = "sch.source_key.source_uuid",
837        default,
838        deserialize_with = "crate::deserialize_present_nonnull",
839        skip_serializing_if = "::std::option::Option::is_none"
840    )]
841    pub sch_source_key_source_uuid: ::std::option::Option<::std::string::String>,
842}
843impl ::std::default::Default for SourceIdentity {
844    fn default() -> Self {
845        Self {
846            sch_source_key_artifact_element: Default::default(),
847            sch_source_key_compiled_net: Default::default(),
848            sch_source_key_source_path: Default::default(),
849            sch_source_key_source_record: Default::default(),
850            sch_source_key_source_subobject: Default::default(),
851            sch_source_key_source_uuid: Default::default(),
852        }
853    }
854}
855///`TerminalOccurrence`
856///
857/// <details><summary>JSON schema</summary>
858///
859/// ```json
860///{
861///  "type": "object",
862///  "required": [
863///    "id",
864///    "name",
865///    "page_occurrence_ref",
866///    "pin_designator",
867///    "role",
868///    "source_identity",
869///    "type"
870///  ],
871///  "properties": {
872///    "component_occurrence_ref": {
873///      "type": "string"
874///    },
875///    "design_component_pin_ref": {
876///      "type": "string"
877///    },
878///    "design_net_ref": {
879///      "type": "string"
880///    },
881///    "id": {
882///      "type": "string"
883///    },
884///    "local_net_occurrence_ref": {
885///      "type": "string"
886///    },
887///    "name": {
888///      "type": "string"
889///    },
890///    "page_occurrence_ref": {
891///      "type": "string"
892///    },
893///    "pin_designator": {
894///      "type": "string"
895///    },
896///    "resolution_diagnostics": {
897///      "type": "array",
898///      "items": {
899///        "$ref": "#/$defs/ResolutionDiagnostic"
900///      }
901///    },
902///    "role": {
903///      "$ref": "#/$defs/TerminalRole"
904///    },
905///    "source_identity": {
906///      "$ref": "#/$defs/SourceIdentity"
907///    },
908///    "type": {
909///      "type": "string",
910///      "const": "sch.terminal_occurrence"
911///    }
912///  },
913///  "additionalProperties": false
914///}
915/// ```
916/// </details>
917#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
918#[serde(deny_unknown_fields)]
919pub struct TerminalOccurrence {
920    #[serde(
921        default,
922        deserialize_with = "crate::deserialize_present_nonnull",
923        skip_serializing_if = "::std::option::Option::is_none"
924    )]
925    pub component_occurrence_ref: ::std::option::Option<::std::string::String>,
926    #[serde(
927        default,
928        deserialize_with = "crate::deserialize_present_nonnull",
929        skip_serializing_if = "::std::option::Option::is_none"
930    )]
931    pub design_component_pin_ref: ::std::option::Option<::std::string::String>,
932    #[serde(
933        default,
934        deserialize_with = "crate::deserialize_present_nonnull",
935        skip_serializing_if = "::std::option::Option::is_none"
936    )]
937    pub design_net_ref: ::std::option::Option<::std::string::String>,
938    pub id: ::std::string::String,
939    #[serde(
940        default,
941        deserialize_with = "crate::deserialize_present_nonnull",
942        skip_serializing_if = "::std::option::Option::is_none"
943    )]
944    pub local_net_occurrence_ref: ::std::option::Option<::std::string::String>,
945    pub name: ::std::string::String,
946    pub page_occurrence_ref: ::std::string::String,
947    pub pin_designator: ::std::string::String,
948    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
949    pub resolution_diagnostics: ::std::vec::Vec<ResolutionDiagnostic>,
950    pub role: TerminalRole,
951    pub source_identity: SourceIdentity,
952    #[serde(rename = "type")]
953    pub type_: ::std::string::String,
954}
955///`TerminalRole`
956///
957/// <details><summary>JSON schema</summary>
958///
959/// ```json
960///{
961///  "type": "string",
962///  "enum": [
963///    "component_pin",
964///    "sheet_entry",
965///    "port",
966///    "power_port"
967///  ]
968///}
969/// ```
970/// </details>
971#[derive(
972    ::serde::Deserialize,
973    ::serde::Serialize,
974    Clone,
975    Copy,
976    Debug,
977    Eq,
978    Hash,
979    Ord,
980    PartialEq,
981    PartialOrd,
982)]
983pub enum TerminalRole {
984    #[serde(rename = "component_pin")]
985    ComponentPin,
986    #[serde(rename = "sheet_entry")]
987    SheetEntry,
988    #[serde(rename = "port")]
989    Port,
990    #[serde(rename = "power_port")]
991    PowerPort,
992}
993impl ::std::fmt::Display for TerminalRole {
994    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
995        match *self {
996            Self::ComponentPin => f.write_str("component_pin"),
997            Self::SheetEntry => f.write_str("sheet_entry"),
998            Self::Port => f.write_str("port"),
999            Self::PowerPort => f.write_str("power_port"),
1000        }
1001    }
1002}
1003impl ::std::str::FromStr for TerminalRole {
1004    type Err = self::error::ConversionError;
1005    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1006        match value {
1007            "component_pin" => Ok(Self::ComponentPin),
1008            "sheet_entry" => Ok(Self::SheetEntry),
1009            "port" => Ok(Self::Port),
1010            "power_port" => Ok(Self::PowerPort),
1011            _ => Err("invalid value".into()),
1012        }
1013    }
1014}
1015impl ::std::convert::TryFrom<&str> for TerminalRole {
1016    type Error = self::error::ConversionError;
1017    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1018        value.parse()
1019    }
1020}
1021impl ::std::convert::TryFrom<&::std::string::String> for TerminalRole {
1022    type Error = self::error::ConversionError;
1023    fn try_from(
1024        value: &::std::string::String,
1025    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1026        value.parse()
1027    }
1028}
1029impl ::std::convert::TryFrom<::std::string::String> for TerminalRole {
1030    type Error = self::error::ConversionError;
1031    fn try_from(
1032        value: ::std::string::String,
1033    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1034        value.parse()
1035    }
1036}
1037///`UnitDefinition`
1038///
1039/// <details><summary>JSON schema</summary>
1040///
1041/// ```json
1042///{
1043///  "type": "object",
1044///  "required": [
1045///    "display_name",
1046///    "id",
1047///    "page_definition_refs",
1048///    "source_identity",
1049///    "type"
1050///  ],
1051///  "properties": {
1052///    "display_name": {
1053///      "type": "string"
1054///    },
1055///    "id": {
1056///      "type": "string"
1057///    },
1058///    "page_definition_refs": {
1059///      "type": "array",
1060///      "items": {
1061///        "type": "string"
1062///      }
1063///    },
1064///    "source_identity": {
1065///      "$ref": "#/$defs/SourceIdentity"
1066///    },
1067///    "type": {
1068///      "type": "string",
1069///      "const": "sch.unit_definition"
1070///    }
1071///  },
1072///  "additionalProperties": false
1073///}
1074/// ```
1075/// </details>
1076#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1077#[serde(deny_unknown_fields)]
1078pub struct UnitDefinition {
1079    pub display_name: ::std::string::String,
1080    pub id: ::std::string::String,
1081    pub page_definition_refs: ::std::vec::Vec<::std::string::String>,
1082    pub source_identity: SourceIdentity,
1083    #[serde(rename = "type")]
1084    pub type_: ::std::string::String,
1085}
1086///`UnitOccurrence`
1087///
1088/// <details><summary>JSON schema</summary>
1089///
1090/// ```json
1091///{
1092///  "type": "object",
1093///  "required": [
1094///    "display_name",
1095///    "id",
1096///    "page_occurrence_refs",
1097///    "source_identity",
1098///    "type",
1099///    "unit_definition_ref"
1100///  ],
1101///  "properties": {
1102///    "display_name": {
1103///      "type": "string"
1104///    },
1105///    "id": {
1106///      "type": "string"
1107///    },
1108///    "page_occurrence_refs": {
1109///      "type": "array",
1110///      "items": {
1111///        "type": "string"
1112///      }
1113///    },
1114///    "parent_hierarchy_occurrence_ref": {
1115///      "type": "string"
1116///    },
1117///    "source_identity": {
1118///      "$ref": "#/$defs/SourceIdentity"
1119///    },
1120///    "type": {
1121///      "type": "string",
1122///      "const": "sch.unit_occurrence"
1123///    },
1124///    "unit_definition_ref": {
1125///      "type": "string"
1126///    }
1127///  },
1128///  "additionalProperties": false
1129///}
1130/// ```
1131/// </details>
1132#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1133#[serde(deny_unknown_fields)]
1134pub struct UnitOccurrence {
1135    pub display_name: ::std::string::String,
1136    pub id: ::std::string::String,
1137    pub page_occurrence_refs: ::std::vec::Vec<::std::string::String>,
1138    #[serde(
1139        default,
1140        deserialize_with = "crate::deserialize_present_nonnull",
1141        skip_serializing_if = "::std::option::Option::is_none"
1142    )]
1143    pub parent_hierarchy_occurrence_ref: ::std::option::Option<::std::string::String>,
1144    pub source_identity: SourceIdentity,
1145    #[serde(rename = "type")]
1146    pub type_: ::std::string::String,
1147    pub unit_definition_ref: ::std::string::String,
1148}