{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/Event/v1/schema.json",
  "title": "Event",
  "description": "Objects Grid Event Object. Something happening at a certain time and place, such as a concert, a lecture or a festival; its tickets are Offers whose itemOffered is the Event. Modeled in compliance with https://schema.org/Event.",
  "type": "object",
  "properties": {
    "at_context": {
      "description": "Schema context",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "https://schema.org"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_type": {
      "description": "The object type",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "Event"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_id": {
      "description": "This Event's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>: its JSON-LD @id, which References point to. Set by the service.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "readOnly": true
    },
    "id": {
      "description": "The unique identifier for Event. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "identifier": {
      "description": "The unique identifier for Event. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "additionalType": {
      "description": "The kind of event, a Schema.org subtype of Event: its JSON-LD @type. CourseInstance, a run of a Course, takes courseMode, courseWorkload, courseSchedule, instructor and instanceOf, which other kinds refuse. None for an Event.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "BusinessEvent",
            "ChildrensEvent",
            "ComedyEvent",
            "CourseInstance",
            "DanceEvent",
            "EducationEvent",
            "ExhibitionEvent",
            "Festival",
            "FoodEvent",
            "Hackathon",
            "LiteraryEvent",
            "MusicEvent",
            "SaleEvent",
            "ScreeningEvent",
            "SocialEvent",
            "SportsEvent",
            "TheaterEvent",
            "VisualArtsEvent"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "description": "The Event name",
      "type": "array",
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/LanguageTaggedString/v1/schema.json"
      },
      "minItems": 1
    },
    "description": {
      "description": "The Event description",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/LanguageTaggedString/v1/schema.json"
      }
    },
    "url": {
      "description": "This Event URL. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "minLength": 1,
      "readOnly": true
    },
    "image": {
      "description": "image URL",
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "startDate": {
      "description": "The start date and time of the event, ISO 8601 with a time zone",
      "type": "string",
      "format": "date-time"
    },
    "endDate": {
      "description": "The end date and time of the event, ISO 8601 with a time zone",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "doorTime": {
      "description": "The time admission will commence",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "duration": {
      "description": "The duration of the event, as an ISO 8601 duration, e.g. 'PT2H'",
      "type": [
        "string",
        "null"
      ],
      "minLength": 3,
      "pattern": "^P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$"
    },
    "eventStatus": {
      "description": "The status of the event: scheduled, cancelled, postponed, rescheduled or moved online",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/EventStatusType/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "eventAttendanceMode": {
      "description": "Whether the event is attended in person, online, or both",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/EventAttendanceModeEnumeration/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "inLanguage": {
      "description": "The language of the event, an IETF BCP 47 language code, e.g. 'en', 'de-AT'",
      "type": [
        "string",
        "null"
      ],
      "minLength": 2,
      "maxLength": 35,
      "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$"
    },
    "isAccessibleForFree": {
      "description": "Whether the event is free",
      "type": [
        "boolean",
        "null"
      ]
    },
    "maximumAttendeeCapacity": {
      "description": "The total number of individuals that may attend",
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0
    },
    "remainingAttendeeCapacity": {
      "description": "The number of attendee places that remain unallocated",
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0
    },
    "previousStartDate": {
      "description": "The start dates of a rescheduled event before it was rescheduled",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "format": "date-time"
      }
    },
    "eventSchedule": {
      "description": "When the event repeats, e.g. every Tuesday at 18:30",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Schedule/v1/schema.json"
      },
      "maxItems": 10
    },
    "courseMode": {
      "description": "CourseInstance: how it is attended: online, onsite or blended",
      "type": [
        "string",
        "null"
      ]
    },
    "courseWorkload": {
      "description": "CourseInstance: the time it takes, an ISO 8601 duration, e.g. PT20H",
      "type": [
        "string",
        "null"
      ],
      "minLength": 3,
      "pattern": "^P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$"
    },
    "courseSchedule": {
      "description": "CourseInstance: when its sessions are",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Schedule/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "instructor": {
      "x-objectsgrid-erasure": "keep",
      "description": "CourseInstance: who teaches it",
      "x-objectsgrid-rangeIncludes": [
        "Person",
        "Organization"
      ],
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
      },
      "maxItems": 20
    },
    "instanceOf": {
      "description": "CourseInstance: the Course it is a run of",
      "x-objectsgrid-rangeIncludes": [
        "Course"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "location": {
      "description": "Where the event happens",
      "x-objectsgrid-rangeIncludes": [
        "Place"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "organizer": {
      "x-objectsgrid-erasure": "keep",
      "description": "The party organizing the event",
      "x-objectsgrid-rangeIncludes": [
        "Organization",
        "Person"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "performer": {
      "x-objectsgrid-erasure": "keep",
      "description": "The performers at the event",
      "x-objectsgrid-rangeIncludes": [
        "Organization",
        "Person"
      ],
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
      },
      "maxItems": 50
    },
    "superEvent": {
      "description": "The event this one is part of, e.g. the festival of a concert",
      "x-objectsgrid-rangeIncludes": [
        "Event"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "subEvent": {
      "description": "The events that are part of this one. Computed, read-only: the objects whose Event.superEvent points to this object, listed from that type; never stored or written.",
      "x-objectsgrid-inverseOf": "Event.superEvent",
      "readOnly": true
    },
    "offers": {
      "description": "The Offers for the event, such as its tickets. Computed, read-only: the objects whose Offer.itemOffered points to this object, listed from that type; never stored or written.",
      "x-objectsgrid-inverseOf": "Offer.itemOffered",
      "readOnly": true
    },
    "tags": {
      "description": "Tags an ABAC policy can decide on. A name may repeat; the same name and value appear once. Every stored object has them: created empty when not sent, kept by a replacement (PUT) that does not mention them, unchanged by a patch that does not mention them, cleared by null or [].",
      "type": "array",
      "default": [],
      "uniqueItems": true,
      "maxItems": 50,
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Tag/v1/schema.json"
      }
    },
    "meta": {
      "description": "System-managed metadata for the object (version, audit fields). Assigned by the server.",
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ObjectMeta/v1/schema.json",
      "readOnly": true
    }
  },
  "required": [
    "name",
    "startDate"
  ],
  "unevaluatedProperties": false,
  "allOf": [
    {
      "if": {
        "required": [
          "additionalType"
        ],
        "properties": {
          "additionalType": {
            "const": "CourseInstance"
          }
        }
      },
      "else": {
        "not": {
          "anyOf": [
            {
              "required": [
                "courseMode"
              ]
            },
            {
              "required": [
                "courseWorkload"
              ]
            },
            {
              "required": [
                "courseSchedule"
              ]
            },
            {
              "required": [
                "instructor"
              ]
            },
            {
              "required": [
                "instanceOf"
              ]
            }
          ]
        }
      }
    }
  ]
}
