{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://law.arxo.io/schema/import-bundle.schema.json",
  "type": "object",
  "properties": {
    "format": {
      "const": "arxo.import.bundle/0.1"
    },
    "input_hash": {
      "type": "string"
    },
    "mapping_hash": {
      "type": "string"
    },
    "policy_hash": {
      "type": "string"
    },
    "plan_hash": {
      "type": "string"
    },
    "compiler_check": {
      "const": "checked"
    },
    "allow_partial": {
      "type": "boolean"
    },
    "packages": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "namespace": {
            "type": "string"
          },
          "content_hash": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "version",
          "namespace",
          "content_hash"
        ],
        "additionalProperties": false
      }
    },
    "correspondence": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "item": {
            "type": "object",
            "properties": {
              "kind": {
                "enum": [
                  "type",
                  "predicate",
                  "reification",
                  "declaration",
                  "fact"
                ]
              },
              "source": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "source"
            ],
            "additionalProperties": false
          },
          "package": {
            "type": "string"
          },
          "target": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "item",
          "package",
          "target"
        ],
        "additionalProperties": false
      }
    },
    "files": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "required": [
    "format",
    "input_hash",
    "mapping_hash",
    "policy_hash",
    "plan_hash",
    "compiler_check",
    "allow_partial",
    "packages",
    "correspondence",
    "files"
  ],
  "additionalProperties": false
}
