{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://model.ccmm.cz/research-data/time-interval/schema.json",
  "title": "Time interval",
  "description": "A temporal entity with an extent or duration",
  "type": "object",
  "required": [
    "beginning",
    "end"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "iri"
    },
    "type": {
      "oneOf": [
        {
          "const": "time_interval"
        },
        {
          "type": "array",
          "contains": {
            "const": "time_interval"
          },
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "beginning": {
      "title": "has beginning",
      "description": "Time instant representing the beginning of a temporal interval.",
      "type": "object",
      "oneOf": [
        {
          "type": "object",
          "required": [
            "date_time"
          ],
          "properties": {
            "date_time": {
              "title": "Date and time",
              "type": "string",
              "format": "date-time"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "date"
          ],
          "properties": {
            "date": {
              "title": "Date",
              "type": "string",
              "format": "date"
            }
          }
        }
      ]
    },
    "end": {
      "title": "has end",
      "description": "Time instant representing the end of a temporal interval.",
      "type": "object",
      "oneOf": [
        {
          "type": "object",
          "required": [
            "date_time"
          ],
          "properties": {
            "date_time": {
              "title": "Date and time",
              "type": "string",
              "format": "date-time"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "date"
          ],
          "properties": {
            "date": {
              "title": "Date",
              "type": "string",
              "format": "date"
            }
          }
        }
      ]
    }
  }
}