{ "$schema":                "https://json-schema.org/draft/2020-12/schema",
  "$id":                    "https://schemas.mpai.community/MMM4/V2.2/data/Event.json",
  "title":                  "Event V2.2",
  "type":                   "object",
  "properties":             {

    "Header":               { "type": "string", "pattern": "^MMM-EVT-V[0-9],{1,2},[.][0-9],{1,2}$" },
    "MInstanceID":          { "type": "string" },
    "EventID":              { "type": "string" },
    "MEnvironmentID":       { "type": "string" },
    "EventTime":            { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SpaceTime.json" },

    "BasicEvent":           { "$ref": "#/$defs/BasicEvent" },

    "EventOrBasicEvent":    { "description": "A (possibly nested) structure composed of Events or BasicEvents.",
                              "type": "array", "items": { "$ref": "#/$defs/EventOrBasicEvent" } },

    "Condition":            { "type": "object", "properties": {
      "If":                 { "type": "string", "enum": ["If"] },
      "Time":               { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Time.json" } } },

    "DataXMData":           { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json" },
    "DescrMetadata":        { "type": "string", "maxLength": 2048 } },

  "$defs":                  {
    "BasicEvent":           { "type": "object", "properties": {
      "PA1":                { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/ProcessAction.json" },
      "LogicOp":            { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/LogicOperators.json" },
      "PA2":                { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/ProcessAction.json" } } },

    "EventOrBasicEvent":    { "description": "One element of the EventOrBasicEvent: either an Event (this schema) or a BasicEvent.", "oneOf": [
                            { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/Event.json" },
                            { "$ref": "#/$defs/BasicEvent" } ] } } }
