{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/asap-cool/json-schema/asap-cool-occurrence-view-schema.json",
  "title": "OccurrenceView",
  "description": "One occurrence of an event in a window.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/asap-cool-calendar-api-openapi.yml#/components/schemas/OccurrenceView",
  "type": "object",
  "required": [
    "event_id",
    "original_start",
    "starts_at",
    "ends_at",
    "is_exception",
    "event"
  ],
  "properties": {
    "ends_at": {
      "type": "string",
      "description": "Actual end (RFC3339)."
    },
    "event": {
      "$ref": "#/$defs/EventView",
      "description": "The event, masked for the caller; `title` / `location` reflect the\noccurrence's own overrides."
    },
    "event_id": {
      "type": "string",
      "format": "uuid",
      "description": "The event (series) it belongs to."
    },
    "is_exception": {
      "type": "boolean",
      "description": "Whether the occurrence was edited on its own."
    },
    "original_start": {
      "type": "string",
      "description": "The occurrence's identity in its series — pass it back as `occurrence`\nto edit or cancel this one (RFC3339)."
    },
    "starts_at": {
      "type": "string",
      "description": "Actual start (RFC3339)."
    }
  },
  "$defs": {
    "AttendeeView": {
      "type": "object",
      "description": "An attendee, on the wire.",
      "required": [
        "id",
        "email",
        "response"
      ],
      "properties": {
        "contact_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Matching contact."
        },
        "display_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Display name."
        },
        "email": {
          "type": "string",
          "description": "Address."
        },
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Stable identifier."
        },
        "invited_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "When the last invitation went out (RFC3339)."
        },
        "responded_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "When they answered (RFC3339)."
        },
        "response": {
          "type": "string",
          "description": "`needs_action`, `accepted`, `declined` or `tentative`."
        }
      }
    },
    "EventTargetView": {
      "type": "object",
      "description": "The object an event is attached to, on the wire.",
      "required": [
        "kind",
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Id of the object in its own schema."
        },
        "kind": {
          "type": "string",
          "description": "`contact`, `deal`, `invoice_document` or `envelope`."
        }
      }
    },
    "EventView": {
      "type": "object",
      "description": "A native event, on the wire.\n\nA private event seen by someone other than its owner comes back as a busy\nslot: `busy = true`, and every detail (`title`, `body`, `location`,\n`conference_url`, `target`, `contact_id`, attendees) is `null` or empty.",
      "required": [
        "id",
        "kind",
        "status",
        "visibility",
        "busy",
        "all_day",
        "starts_at",
        "ends_at",
        "tz",
        "sequence",
        "exceptions",
        "attendees",
        "created_at",
        "updated_at"
      ],
      "properties": {
        "all_day": {
          "type": "boolean",
          "description": "Whether it spans whole days."
        },
        "attendees": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AttendeeView"
          },
          "description": "Invited people."
        },
        "body": {
          "type": [
            "string",
            "null"
          ],
          "description": "Notes."
        },
        "busy": {
          "type": "boolean",
          "description": "Whether the caller only sees a busy slot."
        },
        "conference_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Video-call link."
        },
        "contact_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Contact derived from the target."
        },
        "created_at": {
          "type": "string",
          "description": "Creation timestamp (RFC3339)."
        },
        "ends_at": {
          "type": "string",
          "description": "End of the (first) occurrence (RFC3339)."
        },
        "exceptions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExceptionView"
          },
          "description": "Edited or cancelled occurrences."
        },
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Stable identifier."
        },
        "kind": {
          "type": "string",
          "description": "`meeting`, `focus` or `personal`."
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "description": "Where."
        },
        "owner_user_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Owner, `null` for an org-level event."
        },
        "reminder_minutes": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32",
          "description": "Minutes before each occurrence the owner is reminded (in-app and Web\nPush), `null` for no reminder."
        },
        "rrule": {
          "type": [
            "string",
            "null"
          ],
          "description": "RRULE, `null` for a one-off."
        },
        "sequence": {
          "type": "integer",
          "format": "int32",
          "description": "RFC 5545 SEQUENCE."
        },
        "starts_at": {
          "type": "string",
          "description": "Start of the (first) occurrence (RFC3339)."
        },
        "status": {
          "type": "string",
          "description": "`confirmed`, `tentative` or `cancelled`."
        },
        "target": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/EventTargetView",
              "description": "Attached object."
            }
          ]
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Title."
        },
        "tz": {
          "type": "string",
          "description": "IANA zone."
        },
        "updated_at": {
          "type": "string",
          "description": "Last write timestamp (RFC3339)."
        },
        "visibility": {
          "type": "string",
          "description": "`org` or `private`."
        }
      }
    },
    "ExceptionView": {
      "type": "object",
      "description": "An edited or cancelled occurrence of a series.",
      "required": [
        "original_start",
        "cancelled"
      ],
      "properties": {
        "cancelled": {
          "type": "boolean",
          "description": "Whether it is cancelled."
        },
        "ends_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "Moved end (RFC3339)."
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "description": "Overridden location."
        },
        "original_start": {
          "type": "string",
          "description": "The occurrence's identity: the start the rule produced (RFC3339)."
        },
        "starts_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "Moved start (RFC3339)."
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Overridden title."
        }
      }
    }
  }
}