{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/recal/json-schema/recal-failed-free-busy-user-schema.json",
  "title": "FailedFreeBusyUser",
  "description": "A user whose busy times are missing (failedCalendars empty) or incomplete (failedCalendars names the gaps)",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/recal-organization-scheduling-api-openapi.yml#/components/schemas/FailedFreeBusyUser",
  "type": "object",
  "properties": {
    "customId": {
      "type": "string"
    },
    "failedCalendars": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FailedCalendar"
      }
    },
    "message": {
      "type": "string"
    },
    "reason": {
      "$ref": "#/$defs/FreeBusyFailureReason"
    }
  },
  "required": [
    "customId",
    "failedCalendars",
    "message",
    "reason"
  ],
  "$defs": {
    "FailedCalendar": {
      "type": "object",
      "description": "A calendar that could not be read",
      "properties": {
        "calendarId": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "provider": {
          "enum": [
            "google",
            "microsoft"
          ]
        },
        "reason": {
          "$ref": "#/$defs/FreeBusyFailureReason"
        }
      },
      "required": [
        "calendarId",
        "message",
        "provider",
        "reason"
      ]
    },
    "FreeBusyFailureReason": {
      "enum": [
        "accessDenied",
        "authorizationInvalid",
        "insufficientScopes",
        "invalidCalendarId",
        "mailboxUnavailable",
        "notFound",
        "providerError",
        "providerNotConfigured",
        "rateLimited",
        "tooManyCalendars"
      ],
      "description": "Why a calendar or a user could not be read. What each value means and how to resolve it: https://docs.recal.dev/core/troubleshooting"
    }
  }
}