{
  "$id": "Referee.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "Id.json"
    },
    "version": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991,
      "description": "Raised by the server on every change; clients send the version they last saw so conflicts can be spotted."
    },
    "updatedAt": {
      "$ref": "Timestamp.json"
    },
    "deletedAt": {
      "description": "Set when the record is deleted; deleted records are kept so other devices learn of the deletion.",
      "$ref": "Timestamp.json"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "aliases": {
      "description": "Other names they go by, such as the ones merged into this referee (DUP-3); imports and searches find the referee by them.",
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100
      }
    },
    "email": {
      "type": "string",
      "format": "email",
      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
    },
    "phone": {
      "type": "string",
      "minLength": 1,
      "maxLength": 30
    },
    "notes": {
      "type": "string",
      "maxLength": 2000
    },
    "tags": {
      "$ref": "Tags.json"
    },
    "distinctFrom": {
      "description": "Referees the user said aren't the same person, so they aren't suggested as duplicates again (DUP-5).",
      "maxItems": 500,
      "type": "array",
      "items": {
        "$ref": "Id.json"
      }
    }
  },
  "required": [
    "id",
    "version",
    "updatedAt",
    "name"
  ],
  "additionalProperties": false,
  "description": "Someone the user officiates with."
}
