{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "notarius.dnd.location_registry",
  "type": "object",
  "additionalProperties": false,
  "required": ["locations"],
  "properties": {
    "locations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "name", "source_refs"],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^location:sha256:[0-9a-f]{64}$"
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "source_refs": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["source_id", "start_unit_id", "end_unit_id"],
              "properties": {
                "source_id": {
                  "type": "string",
                  "minLength": 1
                },
                "start_unit_id": {
                  "type": "integer",
                  "minimum": 1
                },
                "end_unit_id": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        }
      }
    }
  }
}
