{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "notarius.dnd.entity_reconcile.llm",
  "type": "object",
  "additionalProperties": false,
  "required": ["duplicate_groups"],
  "properties": {
    "duplicate_groups": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["members", "canonical"],
        "properties": {
          "members": {
            "type": "array",
            "items": {"$ref": "#/$defs/selector"}
          },
          "canonical": {"$ref": "#/$defs/selector"}
        }
      }
    }
  },
  "$defs": {
    "selector": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "source_refs"],
      "properties": {
        "name": {"type": "string", "minLength": 1},
        "source_refs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["start_unit_id", "end_unit_id"],
            "properties": {
              "start_unit_id": {"type": "integer", "minimum": 1},
              "end_unit_id": {"type": "integer", "minimum": 1}
            }
          }
        }
      }
    }
  }
}
