{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:altium-monkey:schema:compiled_view_c0",
  "type": "object",
  "properties": {
    "schema": {
      "type": "string",
      "const": "altium_monkey.compiled_view.c0"
    },
    "root_definition_ref": {
      "$ref": "#/$defs/Identity"
    },
    "definitions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CompiledDefinition"
      }
    },
    "issues": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/QueryIssue"
      }
    }
  },
  "required": [
    "schema",
    "root_definition_ref",
    "definitions",
    "issues"
  ],
  "unevaluatedProperties": {
    "not": {}
  },
  "$defs": {
    "Identity": {
      "type": "string",
      "minLength": 1
    },
    "CompiledDefinition": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/StructuralIdentity"
        },
        "instances": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructuralInstance"
          }
        },
        "terminals": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructuralTerminal"
          }
        },
        "nets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructuralNet"
          }
        },
        "net_bridges": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/NetBridge"
          },
          "description": "One row per bridge component of this definition, in instance order."
        },
        "bridged_groups": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BridgedNetGroup"
          },
          "description": "Derived from net_bridges; a System closure has none of its own."
        },
        "source": {
          "$ref": "#/$defs/DefinitionSource",
          "description": "No source supplied for source-independent structural producers."
        }
      },
      "required": [
        "id",
        "instances",
        "terminals",
        "nets",
        "net_bridges",
        "bridged_groups"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "QueryIssue": {
      "type": "object",
      "properties": {
        "source": {
          "$ref": "#/$defs/SourceOccurrence"
        },
        "target": {
          "$ref": "#/$defs/NetOccurrence"
        },
        "page_ref": {
          "$ref": "#/$defs/Identity"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "StructuralIdentity": {
      "type": "string",
      "minLength": 1,
      "description": "Definition-local opaque nonempty identity. Names and source paths are not refs."
    },
    "StructuralInstance": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/StructuralIdentity"
        },
        "definition_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        }
      },
      "required": [
        "id"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "A physical component (no definition_ref), or one composed child occurrence."
    },
    "StructuralTerminal": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/StructuralIdentity"
        },
        "instance_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        }
      },
      "required": [
        "id"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Physical pin identity; instance_ref identifies its physical component."
    },
    "StructuralNet": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/StructuralIdentity"
        },
        "name": {
          "type": "string",
          "description": "Compiled primary name when one exists. System closure has no primary."
        },
        "members": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructuralMember"
          }
        }
      },
      "required": [
        "id",
        "members"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "NetBridge": {
      "type": "object",
      "properties": {
        "instance_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        },
        "designator": {
          "type": "string"
        },
        "kind": {
          "$ref": "#/$defs/NetBridgeKind"
        },
        "pins": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/NetBridgePin"
          }
        },
        "net_refs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructuralIdentity"
          },
          "description": "The distinct nets of its pins, in net order."
        }
      },
      "required": [
        "instance_ref",
        "designator",
        "kind",
        "pins",
        "net_refs"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "A component that deliberately joins nets on the board, such as a net tie.\nThe joined nets stay separate nets: this records the intended short only.\nAt schematic level a bridge covers all its pins (all its terminals, in\nterminal order). Which pads its board copper actually joins, island by\nisland, is a board fact this graph does not hold."
    },
    "BridgedNetGroup": {
      "type": "object",
      "properties": {
        "net_refs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructuralIdentity"
          },
          "minItems": 2,
          "description": "In net order."
        },
        "bridge_refs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructuralIdentity"
          },
          "minItems": 1,
          "description": "The bridges joining these nets, in bridge order."
        },
        "designators": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The designators of bridge_refs, in the same order."
        }
      },
      "required": [
        "net_refs",
        "bridge_refs",
        "designators"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Nets joined by bridges, transitively, with the bridges that join them.\nOnly groups of two or more nets are listed, in order of their first net."
    },
    "DefinitionSource": {
      "anyOf": [
        {
          "$ref": "#/$defs/DesignSource"
        },
        {
          "$ref": "#/$defs/SystemSource"
        }
      ]
    },
    "SourceOccurrence": {
      "type": "object",
      "properties": {
        "instance_path": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Identity"
          }
        },
        "source_key": {
          "$ref": "#/$defs/CompiledSourceKey"
        }
      },
      "required": [
        "instance_path",
        "source_key"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "NetOccurrence": {
      "type": "object",
      "properties": {
        "instance_path": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Identity"
          }
        },
        "net_ref": {
          "$ref": "#/$defs/Identity"
        }
      },
      "required": [
        "instance_path",
        "net_ref"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Query paths traverse composite instances from the loaded root."
    },
    "Reason": {
      "type": "string",
      "minLength": 1
    },
    "StructuralMember": {
      "anyOf": [
        {
          "$ref": "#/$defs/StructuralTerminalMember"
        },
        {
          "$ref": "#/$defs/StructuralChildNetMember"
        }
      ]
    },
    "NetBridgeKind": {
      "anyOf": [
        {
          "type": "string",
          "const": "net_tie_bom"
        },
        {
          "type": "string",
          "const": "net_tie_no_bom"
        }
      ],
      "description": "Component kinds that bridge nets: Altium Net Tie, In BOM (kind 3) or No BOM (kind 4)."
    },
    "NetBridgePin": {
      "type": "object",
      "properties": {
        "terminal_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        },
        "hardware_designation": {
          "type": "string",
          "description": "Pin designation, for reading; terminal_ref is the identity."
        },
        "net_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        }
      },
      "required": [
        "terminal_ref",
        "hardware_designation"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "One pin of a bridge component; net_ref is absent when the pin is on no net."
    },
    "DesignSource": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "design"
        },
        "project_path": {
          "type": "string"
        },
        "components": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ComponentInfo"
          }
        },
        "terminals": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TerminalInfo"
          }
        },
        "compile_context": {
          "$ref": "#/$defs/CompileContext"
        },
        "net_naming": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DesignNetNaming"
          },
          "description": "Exactly one row per canonical net in this Design definition."
        },
        "schematic_graph": {
          "$ref": "urn:altium-monkey:schema:compiled_schematic_graph_b0"
        }
      },
      "required": [
        "kind",
        "project_path",
        "components",
        "terminals",
        "compile_context",
        "net_naming",
        "schematic_graph"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemSource": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "system"
        },
        "project_path": {
          "type": "string"
        },
        "modules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SystemModule"
          }
        },
        "entries": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SystemEntry"
          }
        },
        "pins": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SystemPin"
          }
        },
        "connections": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SystemConnection"
          }
        },
        "physical_connections": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PhysicalConnection"
          }
        },
        "links": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SystemLink"
          }
        },
        "drawing_associations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SystemDrawingAssociation"
          },
          "description": "Absent means drawing decoding not supplied, never a proven empty page."
        },
        "issues": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalIssue"
          }
        }
      },
      "required": [
        "kind",
        "project_path",
        "modules",
        "entries",
        "pins",
        "connections",
        "physical_connections",
        "links",
        "issues"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "CompiledSourceKey": {
      "anyOf": [
        {
          "$ref": "#/$defs/SchematicSourceKey"
        },
        {
          "$ref": "#/$defs/SystemSourceKey"
        },
        {
          "$ref": "#/$defs/SystemDrawingSourceKey"
        }
      ]
    },
    "StructuralTerminalMember": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "terminal"
        },
        "terminal_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        }
      },
      "required": [
        "type",
        "terminal_ref"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Membership is stored once, at its owning definition."
    },
    "StructuralChildNetMember": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "child_net"
        },
        "instance_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        },
        "net_ref": {
          "$ref": "#/$defs/StructuralIdentity"
        }
      },
      "required": [
        "type",
        "instance_ref",
        "net_ref"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Immediate child binding. Deep instance paths are derived by traversal."
    },
    "ComponentInfo": {
      "type": "object",
      "properties": {
        "instance_ref": {
          "$ref": "#/$defs/Identity"
        },
        "designator": {
          "type": "string"
        }
      },
      "required": [
        "instance_ref",
        "designator"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "TerminalInfo": {
      "type": "object",
      "properties": {
        "terminal_ref": {
          "$ref": "#/$defs/Identity"
        },
        "hardware_designation": {
          "type": "string"
        },
        "pin_name": {
          "$ref": "#/$defs/NullableText"
        }
      },
      "required": [
        "terminal_ref",
        "hardware_designation",
        "pin_name"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "CompileContext": {
      "anyOf": [
        {
          "$ref": "#/$defs/KnownCompileContext"
        },
        {
          "$ref": "#/$defs/UnavailableCompileContext"
        }
      ]
    },
    "DesignNetNaming": {
      "type": "object",
      "properties": {
        "net_ref": {
          "$ref": "#/$defs/Identity"
        },
        "auto_named": {
          "type": "boolean"
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "original_name": {
          "$ref": "#/$defs/NullableText"
        },
        "override_name": {
          "$ref": "#/$defs/NullableText"
        },
        "origin": {
          "$ref": "#/$defs/NamingOrigin"
        }
      },
      "required": [
        "net_ref",
        "auto_named",
        "aliases",
        "original_name",
        "override_name",
        "origin"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Facts copied from the actual compiled_flat row mapped to this canonical net."
    },
    "SystemModule": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "designator": {
          "$ref": "#/$defs/NullableText"
        },
        "instance_binding": {
          "$ref": "#/$defs/InstanceBinding"
        }
      },
      "required": [
        "source_key",
        "designator",
        "instance_binding"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemEntry": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "owner_source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "designator": {
          "$ref": "#/$defs/NullableText"
        }
      },
      "required": [
        "source_key",
        "owner_source_key",
        "designator"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemPin": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "entry_source_key": {
          "$ref": "#/$defs/NullableSystemSourceKey",
          "description": "Effective native entry association; original maps are not asserted inverses."
        },
        "pin_number": {
          "$ref": "#/$defs/NullableText"
        },
        "pin_name": {
          "$ref": "#/$defs/NullableText"
        },
        "snapshot_name": {
          "$ref": "#/$defs/NullableText"
        },
        "resolved_snapshot_name": {
          "$ref": "#/$defs/NullableText"
        },
        "child_binding": {
          "$ref": "#/$defs/ChildBinding"
        },
        "system_net_binding": {
          "$ref": "#/$defs/NetBinding"
        }
      },
      "required": [
        "source_key",
        "entry_source_key",
        "pin_number",
        "pin_name",
        "snapshot_name",
        "resolved_snapshot_name",
        "child_binding",
        "system_net_binding"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemConnection": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "designator": {
          "$ref": "#/$defs/NullableText"
        }
      },
      "required": [
        "source_key",
        "designator"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "PhysicalConnection": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "connection_source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        }
      },
      "required": [
        "source_key",
        "connection_source_key"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemLink": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "physical_connection_source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        },
        "endpoints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LinkEndpoint"
          },
          "minItems": 2,
          "maxItems": 2
        },
        "defined_name": {
          "$ref": "#/$defs/NullableName"
        },
        "derived_name": {
          "$ref": "#/$defs/NullableName"
        },
        "system_net_binding": {
          "$ref": "#/$defs/NetBinding"
        }
      },
      "required": [
        "source_key",
        "physical_connection_source_key",
        "endpoints",
        "defined_name",
        "derived_name",
        "system_net_binding"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemDrawingAssociation": {
      "type": "object",
      "properties": {
        "drawing_source_key": {
          "$ref": "#/$defs/SystemDrawingSourceKey"
        },
        "logical_source_keys": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SystemSourceKey"
          }
        },
        "issues": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalIssue"
          }
        }
      },
      "required": [
        "drawing_source_key",
        "logical_source_keys",
        "issues"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Native drawing binder evidence, not geometry or canonical electrical membership."
    },
    "LocalIssue": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/CompiledSourceKey"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SchematicSourceKey": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "schematic"
        },
        "document_path": {
          "type": "string"
        },
        "locator": {
          "$ref": "#/$defs/OwnedSourceLocator"
        }
      },
      "required": [
        "kind",
        "document_path",
        "locator"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemSourceKey": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "system"
        },
        "document_path": {
          "type": "string"
        },
        "object_kind": {
          "$ref": "#/$defs/SystemObjectKind"
        },
        "owner_path": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": -2147483648,
            "maximum": 2147483647
          },
          "minItems": 1
        }
      },
      "required": [
        "kind",
        "document_path",
        "object_kind",
        "owner_path"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SystemDrawingSourceKey": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "system_drawing"
        },
        "document_path": {
          "type": "string"
        },
        "page_member": {
          "type": "string"
        },
        "item_id": {
          "type": "integer",
          "minimum": -2147483648,
          "maximum": 2147483647
        }
      },
      "required": [
        "kind",
        "document_path",
        "page_member",
        "item_id"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Authored MBS drawing item, distinct from a logical pin or connection."
    },
    "NullableText": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "KnownCompileContext": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "known"
        },
        "hierarchy_mode": {
          "type": "string",
          "description": "Existing compiler spelling, including STRICT_HIERARCHICAL and raw modes."
        },
        "hierarchy_mode_value": {
          "type": "integer",
          "minimum": -2147483648,
          "maximum": 2147483647
        },
        "effective_hierarchy_mode": {
          "type": "string"
        },
        "allow_port_net_names": {
          "type": "boolean"
        },
        "allow_sheet_entry_net_names": {
          "type": "boolean"
        },
        "netlist_single_pin_nets": {
          "type": "boolean"
        },
        "append_sheet_number_to_local_nets": {
          "type": "boolean"
        },
        "power_port_names_take_priority": {
          "type": "boolean"
        },
        "name_nets_hierarchically": {
          "type": "boolean"
        },
        "auto_sheet_numbering": {
          "type": "boolean"
        },
        "allow_device_sheet_editing": {
          "type": "boolean"
        },
        "channel_designator_format": {
          "type": "string"
        },
        "channel_room_naming_style": {
          "type": "integer",
          "minimum": -2147483648,
          "maximum": 2147483647
        },
        "channel_room_level_separator": {
          "type": "string"
        },
        "new_indexing_of_sheet_symbols": {
          "type": "boolean"
        },
        "reorder_documents_on_compile": {
          "type": "boolean"
        },
        "push_eco_to_annotation_file": {
          "type": "boolean"
        },
        "deferred_options": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Actual compiler-deferred inputs; these are not active scope options."
        }
      },
      "required": [
        "status",
        "hierarchy_mode",
        "hierarchy_mode_value",
        "effective_hierarchy_mode",
        "allow_port_net_names",
        "allow_sheet_entry_net_names",
        "netlist_single_pin_nets",
        "append_sheet_number_to_local_nets",
        "power_port_names_take_priority",
        "name_nets_hierarchically",
        "auto_sheet_numbering",
        "allow_device_sheet_editing",
        "channel_designator_format",
        "channel_room_naming_style",
        "channel_room_level_separator",
        "new_indexing_of_sheet_symbols",
        "reorder_documents_on_compile",
        "push_eco_to_annotation_file",
        "deferred_options"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Frozen resolved options already owned by AltiumProjectCompileOptions."
    },
    "UnavailableCompileContext": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "unavailable"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "status",
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "NamingOrigin": {
      "anyOf": [
        {
          "$ref": "#/$defs/KnownNamingOrigin"
        },
        {
          "$ref": "#/$defs/UnavailableNamingOrigin"
        }
      ]
    },
    "InstanceBinding": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExactInstance"
        },
        {
          "$ref": "#/$defs/Unresolved"
        },
        {
          "$ref": "#/$defs/Ambiguous"
        },
        {
          "$ref": "#/$defs/NotApplicable"
        }
      ]
    },
    "NullableSystemSourceKey": {
      "anyOf": [
        {
          "$ref": "#/$defs/SystemSourceKey"
        },
        {
          "type": "null"
        }
      ]
    },
    "ChildBinding": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExactChildTerminal"
        },
        {
          "$ref": "#/$defs/Unresolved"
        },
        {
          "$ref": "#/$defs/Ambiguous"
        },
        {
          "$ref": "#/$defs/NotApplicable"
        }
      ]
    },
    "NetBinding": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExactNet"
        },
        {
          "$ref": "#/$defs/Unresolved"
        },
        {
          "$ref": "#/$defs/Ambiguous"
        },
        {
          "$ref": "#/$defs/NotApplicable"
        }
      ]
    },
    "LinkEndpoint": {
      "anyOf": [
        {
          "$ref": "#/$defs/PresentEndpoint"
        },
        {
          "$ref": "#/$defs/NoPinEndpoint"
        },
        {
          "$ref": "#/$defs/UnresolvedEndpoint"
        },
        {
          "$ref": "#/$defs/AmbiguousEndpoint"
        }
      ]
    },
    "NullableName": {
      "anyOf": [
        {
          "$ref": "#/$defs/NonemptyName"
        },
        {
          "type": "null"
        }
      ]
    },
    "OwnedSourceLocator": {
      "anyOf": [
        {
          "$ref": "#/$defs/PersistedUidLocator"
        },
        {
          "$ref": "#/$defs/SourceOrdinalLocator"
        }
      ]
    },
    "SystemObjectKind": {
      "anyOf": [
        {
          "type": "string",
          "const": "module"
        },
        {
          "type": "string",
          "const": "entry"
        },
        {
          "type": "string",
          "const": "pin"
        },
        {
          "type": "string",
          "const": "connection"
        },
        {
          "type": "string",
          "const": "physical_connection"
        },
        {
          "type": "string",
          "const": "pin_pair"
        }
      ],
      "description": "Native logical kinds already admitted by the System source inventory."
    },
    "KnownNamingOrigin": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "known"
        },
        "kind": {
          "$ref": "#/$defs/NamingOriginKind",
          "description": "Origin of original_name before any retained override, not auto_named."
        },
        "winning_field": {
          "$ref": "#/$defs/LocalWinningField",
          "description": "Present only when the actual resolver selected this exact source field."
        }
      },
      "required": [
        "status",
        "kind"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "UnavailableNamingOrigin": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "unavailable"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "status",
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "ExactInstance": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "exact"
        },
        "instance_ref": {
          "$ref": "#/$defs/Identity"
        }
      },
      "required": [
        "status",
        "instance_ref"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "Unresolved": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "unresolved"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "status",
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "Ambiguous": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "ambiguous"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "status",
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "NotApplicable": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "not_applicable"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "status",
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "ExactChildTerminal": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "exact"
        },
        "target": {
          "$ref": "#/$defs/ChildTerminalTarget"
        }
      },
      "required": [
        "status",
        "target"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "ExactNet": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "exact"
        },
        "net_ref": {
          "$ref": "#/$defs/Identity"
        }
      },
      "required": [
        "status",
        "net_ref"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "PresentEndpoint": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "present"
        },
        "source_key": {
          "$ref": "#/$defs/SystemSourceKey"
        }
      },
      "required": [
        "status",
        "source_key"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "NoPinEndpoint": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "no_pin"
        }
      },
      "required": [
        "status"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "UnresolvedEndpoint": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "unresolved"
        },
        "source_pin_id": {
          "$ref": "#/$defs/NullableNativePinId"
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "status",
        "source_pin_id",
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "A missing/null native side is distinct from the persisted NoPin sentinel."
    },
    "AmbiguousEndpoint": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "ambiguous"
        },
        "source_pin_id": {
          "type": "integer",
          "minimum": -2147483648,
          "maximum": 2147483647
        },
        "reason": {
          "$ref": "#/$defs/Reason"
        }
      },
      "required": [
        "status",
        "source_pin_id",
        "reason"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "NonemptyName": {
      "type": "string",
      "minLength": 1
    },
    "PersistedUidLocator": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "persisted_uid"
        },
        "owner_source_key": {
          "$ref": "#/$defs/NullableSourceKey"
        },
        "record_kind": {
          "$ref": "#/$defs/RecordKind"
        },
        "unique_id": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "owner_source_key",
        "record_kind",
        "unique_id"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "SourceOrdinalLocator": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "source_ordinal"
        },
        "owner_source_key": {
          "$ref": "#/$defs/NullableSourceKey"
        },
        "record_kind": {
          "$ref": "#/$defs/RecordKind"
        },
        "source_ordinal": {
          "$ref": "#/$defs/Nat"
        }
      },
      "required": [
        "kind",
        "owner_source_key",
        "record_kind",
        "source_ordinal"
      ],
      "unevaluatedProperties": {
        "not": {}
      }
    },
    "NamingOriginKind": {
      "anyOf": [
        {
          "type": "string",
          "const": "authored"
        },
        {
          "type": "string",
          "const": "generated"
        },
        {
          "type": "string",
          "const": "derived"
        }
      ]
    },
    "LocalWinningField": {
      "type": "object",
      "properties": {
        "source_key": {
          "$ref": "#/$defs/SchematicSourceKey"
        },
        "field": {
          "$ref": "#/$defs/NameField"
        }
      },
      "required": [
        "source_key",
        "field"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Exact source field selected by a retained naming decision, not value equality."
    },
    "ChildTerminalTarget": {
      "type": "object",
      "properties": {
        "instance_path": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Identity"
          }
        },
        "terminal_ref": {
          "$ref": "#/$defs/Identity"
        }
      },
      "required": [
        "instance_path",
        "terminal_ref"
      ],
      "unevaluatedProperties": {
        "not": {}
      },
      "description": "Stored child path is anchored at its owning System definition."
    },
    "NullableNativePinId": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": -2147483648,
          "maximum": 2147483647
        },
        {
          "type": "null"
        }
      ],
      "description": "Raw native nullable pin side; the NoPin sentinel has its own endpoint kind."
    },
    "NullableSourceKey": {
      "anyOf": [
        {
          "$ref": "#/$defs/SourceKey"
        },
        {
          "type": "null"
        }
      ]
    },
    "RecordKind": {
      "anyOf": [
        {
          "type": "string",
          "const": "line"
        },
        {
          "type": "string",
          "const": "rectangle"
        },
        {
          "type": "string",
          "const": "round_rectangle"
        },
        {
          "type": "string",
          "const": "ellipse"
        },
        {
          "type": "string",
          "const": "arc"
        },
        {
          "type": "string",
          "const": "elliptical_arc"
        },
        {
          "type": "string",
          "const": "polygon"
        },
        {
          "type": "string",
          "const": "polyline"
        },
        {
          "type": "string",
          "const": "bezier"
        },
        {
          "type": "string",
          "const": "pie_chart"
        },
        {
          "type": "string",
          "const": "component"
        },
        {
          "type": "string",
          "const": "pin"
        },
        {
          "type": "string",
          "const": "ieee_symbol"
        },
        {
          "type": "string",
          "const": "label"
        },
        {
          "type": "string",
          "const": "parameter"
        },
        {
          "type": "string",
          "const": "designator"
        },
        {
          "type": "string",
          "const": "image"
        },
        {
          "type": "string",
          "const": "note"
        },
        {
          "type": "string",
          "const": "text_frame"
        },
        {
          "type": "string",
          "const": "wire"
        },
        {
          "type": "string",
          "const": "bus"
        },
        {
          "type": "string",
          "const": "bus_entry"
        },
        {
          "type": "string",
          "const": "junction"
        },
        {
          "type": "string",
          "const": "net_label"
        },
        {
          "type": "string",
          "const": "power_port"
        },
        {
          "type": "string",
          "const": "port"
        },
        {
          "type": "string",
          "const": "no_erc"
        },
        {
          "type": "string",
          "const": "sheet_symbol"
        },
        {
          "type": "string",
          "const": "sheet_entry"
        },
        {
          "type": "string",
          "const": "sheet"
        },
        {
          "type": "string",
          "const": "sheet_name"
        },
        {
          "type": "string",
          "const": "file_name"
        },
        {
          "type": "string",
          "const": "implementation_list"
        },
        {
          "type": "string",
          "const": "implementation"
        },
        {
          "type": "string",
          "const": "map_definer"
        },
        {
          "type": "string",
          "const": "harness_connector"
        },
        {
          "type": "string",
          "const": "harness_entry"
        },
        {
          "type": "string",
          "const": "harness_type"
        },
        {
          "type": "string",
          "const": "signal_harness"
        },
        {
          "type": "string",
          "const": "harness_splice"
        },
        {
          "type": "string",
          "const": "harness_layout_label"
        },
        {
          "type": "string",
          "const": "harness_layout_connection_point"
        },
        {
          "type": "string",
          "const": "harness_bundle"
        },
        {
          "type": "string",
          "const": "harness_covering"
        },
        {
          "type": "string",
          "const": "template"
        },
        {
          "type": "string",
          "const": "parameter_set"
        },
        {
          "type": "string",
          "const": "compile_mask"
        },
        {
          "type": "string",
          "const": "blanket"
        },
        {
          "type": "string",
          "const": "hyperlink"
        },
        {
          "type": "string",
          "const": "file_header"
        },
        {
          "type": "string",
          "const": "map_definer_list"
        },
        {
          "type": "string",
          "const": "impl_params"
        }
      ]
    },
    "Nat": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "JSON-safe nonnegative integer."
    },
    "NameField": {
      "anyOf": [
        {
          "type": "string",
          "const": "Name"
        },
        {
          "type": "string",
          "const": "Text"
        }
      ],
      "description": "Authored naming field families. Record-kind checks remain semantic."
    },
    "SourceKey": {
      "type": "string",
      "pattern": "^source:sha256:[0-9a-f]{64}$",
      "description": "Document-scoped source identity digest."
    }
  }
}
