{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://interchange.stellarview.net/schemas/mappings/events.schema.json",
  "title": "Mapping: events. Data, editable in Setup, versioned, each with its source.",
  "type": "object",
  "required": [
    "mapping",
    "version",
    "updated",
    "updated_by",
    "source",
    "items",
    "i3_events"
  ],
  "additionalProperties": false,
  "properties": {
    "mapping": {
      "const": "events"
    },
    "version": {
      "type": "integer",
      "minimum": 1
    },
    "updated": {
      "type": "string"
    },
    "updated_by": {
      "type": "string",
      "minLength": 1
    },
    "about": {
      "type": "string"
    },
    "source": {
      "type": "object",
      "required": [
        "cite"
      ],
      "additionalProperties": false,
      "properties": {
        "cite": {
          "type": "string",
          "minLength": 1
        },
        "read": {
          "type": "string"
        }
      }
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "event",
          "jira",
          "source"
        ],
        "additionalProperties": false,
        "properties": {
          "event": {
            "type": "string",
            "pattern": "^([a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*|[a-z][a-z0-9_]*\\.\\*)$"
          },
          "jira": {
            "type": "object",
            "required": [
              "issue_type",
              "priority_by_severity"
            ],
            "additionalProperties": false,
            "properties": {
              "issue_type": {
                "type": "string"
              },
              "priority_by_severity": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "state": {
                "enum": [
                  "to_confirm",
                  "confirmed"
                ]
              }
            }
          },
          "source": {
            "type": "object",
            "required": [
              "cite"
            ],
            "additionalProperties": false,
            "properties": {
              "cite": {
                "type": "string",
                "minLength": 1
              },
              "read": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "i3_events": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "i3_event",
          "catalogue",
          "state",
          "source"
        ],
        "additionalProperties": false,
        "properties": {
          "i3_event": {
            "type": "string"
          },
          "catalogue": {
            "type": "string"
          },
          "state": {
            "enum": [
              "to_confirm",
              "confirmed"
            ]
          },
          "source": {
            "type": "object",
            "required": [
              "cite"
            ],
            "additionalProperties": false,
            "properties": {
              "cite": {
                "type": "string",
                "minLength": 1
              },
              "read": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
