{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Legends Wall duel import v1",
  "description": "Historical duels. Target club and active discipline are selected separately. Member text and tags also follow ordinary product semantic rules.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "format_version",
    "participants",
    "duels"
  ],
  "properties": {
    "format": {
      "const": "legends-wall-duel-import",
      "type": "string"
    },
    "format_version": {
      "const": 1,
      "type": "integer"
    },
    "participants": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source_id",
          "display_name",
          "handle"
        ],
        "properties": {
          "source_id": {
            "type": "string",
            "minLength": 1
          },
          "display_name": {
            "type": "string"
          },
          "handle": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "duels": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "index",
          "played_at",
          "participants",
          "tags"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0
          },
          "played_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}[Tt][0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$"
          },
          "participants": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "source_id",
                "place"
              ],
              "properties": {
                "source_id": {
                  "type": "string",
                  "minLength": 1
                },
                "place": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
