{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "urn:wavenumber:schema:kicad_monkey.compiled_schematic_graph:a0",
    "type": "object",
    "properties": {
        "schema": {
            "type": "string",
            "const": "kicad_monkey.compiled_schematic_graph.a0"
        },
        "type": {
            "type": "string",
            "const": "sch.compiled_schematic_graph"
        },
        "identity_namespace": {
            "type": "string",
            "const": "sch.compiled_schematic_graph.a0"
        },
        "unit_definitions": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/UnitDefinition"
            }
        },
        "page_definitions": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/PageDefinition"
            }
        },
        "unit_occurrences": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/UnitOccurrence"
            }
        },
        "page_occurrences": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/PageOccurrence"
            }
        },
        "hierarchy_occurrences": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/HierarchyOccurrence"
            }
        },
        "component_occurrences": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/ComponentOccurrence"
            }
        },
        "local_net_occurrences": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/LocalNetOccurrence"
            }
        },
        "terminal_occurrences": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/TerminalOccurrence"
            }
        },
        "hierarchy_terminal_bindings": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/HierarchyTerminalBinding"
            }
        },
        "graphical_artifact_links": {
            "type": "array",
            "items": {
                "$ref": "#/$defs/GraphicalArtifactLink"
            }
        }
    },
    "required": [
        "schema",
        "type",
        "identity_namespace",
        "unit_definitions",
        "page_definitions",
        "unit_occurrences",
        "page_occurrences",
        "hierarchy_occurrences",
        "component_occurrences",
        "local_net_occurrences",
        "terminal_occurrences",
        "hierarchy_terminal_bindings",
        "graphical_artifact_links"
    ],
    "unevaluatedProperties": {
        "not": {}
    },
    "description": "Complete variant-neutral schematic occurrence and connectivity graph.",
    "title": "Compiled schematic graph a0",
    "$defs": {
        "UnitDefinition": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.unit_definition"
                },
                "id": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "page_definition_refs": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "display_name",
                "page_definition_refs",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "PageDefinition": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.page_definition"
                },
                "id": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "unit_definition_ref": {
                    "type": "string"
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "display_name",
                "unit_definition_ref",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "UnitOccurrence": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.unit_occurrence"
                },
                "id": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "unit_definition_ref": {
                    "type": "string"
                },
                "page_occurrence_refs": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "parent_hierarchy_occurrence_ref": {
                    "type": "string"
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "display_name",
                "unit_definition_ref",
                "page_occurrence_refs",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "PageOccurrence": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.page_occurrence"
                },
                "id": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "page_definition_ref": {
                    "type": "string"
                },
                "unit_occurrence_ref": {
                    "type": "string"
                },
                "address_key": {
                    "type": "string"
                },
                "sheet_number": {
                    "type": "string"
                },
                "instance_order": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 4294967295
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "display_name",
                "page_definition_ref",
                "unit_occurrence_ref",
                "instance_order",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "HierarchyOccurrence": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.hierarchy_occurrence"
                },
                "id": {
                    "type": "string"
                },
                "parent_unit_occurrence_ref": {
                    "type": "string"
                },
                "parent_page_occurrence_ref": {
                    "type": "string"
                },
                "child_unit_occurrence_ref": {
                    "type": "string"
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "parent_unit_occurrence_ref",
                "parent_page_occurrence_ref",
                "child_unit_occurrence_ref",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "ComponentOccurrence": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.component_occurrence"
                },
                "id": {
                    "type": "string"
                },
                "page_occurrence_ref": {
                    "type": "string"
                },
                "design_component_ref": {
                    "type": "string"
                },
                "source_designator": {
                    "type": "string"
                },
                "physical_designator": {
                    "type": "string"
                },
                "display_designator": {
                    "type": "string"
                },
                "unit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4294967295
                },
                "body_style": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 4294967295
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "page_occurrence_ref",
                "source_designator",
                "physical_designator",
                "display_designator",
                "unit",
                "body_style",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "LocalNetOccurrence": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.local_net_occurrence"
                },
                "id": {
                    "type": "string"
                },
                "page_occurrence_ref": {
                    "type": "string"
                },
                "display_name": {
                    "type": "string"
                },
                "design_net_ref": {
                    "type": "string"
                },
                "qualified_name": {
                    "type": "string"
                },
                "aliases": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "page_occurrence_ref",
                "display_name",
                "aliases",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "TerminalOccurrence": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.terminal_occurrence"
                },
                "id": {
                    "type": "string"
                },
                "page_occurrence_ref": {
                    "type": "string"
                },
                "role": {
                    "$ref": "#/$defs/TerminalRole"
                },
                "local_net_occurrence_ref": {
                    "type": "string"
                },
                "design_net_ref": {
                    "type": "string"
                },
                "component_occurrence_ref": {
                    "type": "string"
                },
                "design_component_pin_ref": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "pin_designator": {
                    "type": "string"
                },
                "resolution_diagnostics": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/ResolutionDiagnostic"
                    }
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "page_occurrence_ref",
                "role",
                "name",
                "pin_designator",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "HierarchyTerminalBinding": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.hierarchy_terminal_binding"
                },
                "id": {
                    "type": "string"
                },
                "hierarchy_occurrence_ref": {
                    "type": "string"
                },
                "parent_terminal_occurrence_ref": {
                    "type": "string"
                },
                "child_terminal_occurrence_ref": {
                    "type": "string"
                },
                "design_net_ref": {
                    "type": "string"
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "hierarchy_occurrence_ref",
                "parent_terminal_occurrence_ref",
                "child_terminal_occurrence_ref",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "GraphicalArtifactLink": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "const": "sch.graphical_artifact_link"
                },
                "id": {
                    "type": "string"
                },
                "page_occurrence_ref": {
                    "type": "string"
                },
                "target_type": {
                    "$ref": "#/$defs/GraphicalTargetType"
                },
                "target_ref": {
                    "type": "string"
                },
                "artifact_key": {
                    "type": "string",
                    "const": "sch.dwg_scene"
                },
                "element_id": {
                    "type": "string"
                },
                "source_identity": {
                    "$ref": "#/$defs/SourceIdentity"
                }
            },
            "required": [
                "type",
                "id",
                "page_occurrence_ref",
                "target_type",
                "target_ref",
                "artifact_key",
                "element_id",
                "source_identity"
            ],
            "unevaluatedProperties": {
                "not": {}
            }
        },
        "SourceIdentity": {
            "type": "object",
            "properties": {
                "sch.source_key.source_uuid": {
                    "type": "string"
                },
                "sch.source_key.source_path": {
                    "type": "string"
                },
                "sch.source_key.source_record": {
                    "type": "string"
                },
                "sch.source_key.source_subobject": {
                    "type": "string"
                },
                "sch.source_key.compiled_net": {
                    "type": "string"
                },
                "sch.source_key.artifact_element": {
                    "type": "string"
                }
            },
            "unevaluatedProperties": {
                "not": {}
            },
            "description": "Registered producer provenance retained for importer replay and diagnostics."
        },
        "TerminalRole": {
            "type": "string",
            "enum": [
                "component_pin",
                "sheet_entry",
                "port",
                "power_port"
            ]
        },
        "ResolutionDiagnostic": {
            "type": "string",
            "enum": [
                "logical_pin_unresolved",
                "component_occurrence_unresolved",
                "hierarchy_terminal_binding_unresolved",
                "design_net_unresolved"
            ]
        },
        "GraphicalTargetType": {
            "type": "string",
            "enum": [
                "sch.component_occurrence",
                "sch.hierarchy_occurrence",
                "sch.terminal_occurrence",
                "sch.local_net_occurrence",
                "sch.page_occurrence"
            ]
        }
    }
}