{
  "$id": "https://intentschema.org/intents/productivity/calendar/availability/query/v1.json",
  "fqdn": "org.intentschema.productivity.calendar.availability.query.v1",
  "title": "Query calendar availability",
  "description": "Query free/busy information for one or more calendars over a time range. Inspired by RFC 5545 VFREEBUSY and RFC 7953 VAVAILABILITY.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target",
      "object"
    ],
    "properties": {
      "target": {
        "$ref": "https://intentschema.org/common/target/v1.json"
      },
      "object": {
        "type": "object",
        "required": [
          "calendars",
          "after",
          "before"
        ],
        "properties": {
          "calendars": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            },
            "description": "Calendar owners (typically email addresses) to query."
          },
          "after": {
            "type": "string",
            "format": "date-time"
          },
          "before": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string"
          }
        }
      }
    }
  },
  "result": {
    "type": "object",
    "properties": {
      "calendars": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "busy": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "end": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "examples": [
    {
      "name": "two-person free/busy",
      "value": {
        "target": {
          "system": "google_calendar"
        },
        "object": {
          "calendars": [
            "alice@acme.com",
            "bob@acme.com"
          ],
          "after": "2026-04-22T00:00:00-07:00",
          "before": "2026-04-22T23:59:59-07:00"
        }
      }
    }
  ]
}
