{
  "$comment": "GENERATED FILE — DO NOT EDIT DIRECTLY. Source: packages/schemas/src. Regenerate with `npm run generate:json-schema --workspace=@spacecorp/schemas`.",
  "$id": "https://spacecorp.io/schemas/part-register.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "number",
      "const": 1
    },
    "project": {
      "type": "string",
      "pattern": "^scp-[a-z0-9][a-z0-9-]*$"
    },
    "artifact": {
      "type": "string",
      "pattern": "^artifact-[a-z0-9][a-z0-9-]*$"
    },
    "artifact_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "extracted_by": {
      "type": "string",
      "const": "scripts/extract-twin-parts.ts"
    },
    "parts": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^part-[a-z0-9][a-z0-9-]*$"
          },
          "twin_part_id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_.]*$"
          },
          "subsystem": {
            "type": "string",
            "pattern": "^sys-[a-z0-9][a-z0-9-]*$"
          },
          "parent": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^part-[a-z0-9][a-z0-9-]*$"
              },
              {
                "type": "null"
              }
            ]
          },
          "level": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 5
              },
              {
                "type": "null"
              }
            ]
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "evidence": {
            "type": "string",
            "enum": [
              "measured",
              "photo",
              "catalogue",
              "published",
              "generic"
            ]
          },
          "oem_part_number": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "fastener": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "minLength": 1
                  },
                  "spec": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "kind",
                  "spec"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "torque_nm": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "member": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "extrusion",
                  "casting",
                  "sheet"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "twin_part_id",
          "subsystem",
          "parent",
          "level",
          "label",
          "evidence",
          "oem_part_number",
          "fastener",
          "torque_nm",
          "member",
          "notes"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "schema_version",
    "project",
    "artifact",
    "artifact_sha256",
    "extracted_by",
    "parts"
  ],
  "additionalProperties": false
}
