{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eightfold-ai/json-schema/eightfold-ai-booking-schema-schema.json",
  "title": "BookingSchema",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eightfold-ai-booking-api-openapi.yml#/components/schemas/BookingSchema",
  "type": "object",
  "properties": {
    "createdAt": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "readOnly": true,
      "description": "Created timestamp for the booking"
    },
    "updatedBy": {
      "type": [
        "string",
        "null"
      ],
      "description": "User who updated the booking"
    },
    "isArchived": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "A flag indicating if booking is archived"
    },
    "startDateIso": {
      "type": "string",
      "description": "Start date of the booking in ISO format (YYYY-MM-DD)"
    },
    "extData": {
      "readOnly": true,
      "description": "External data associated with the booking",
      "allOf": [
        {
          "$ref": "#/$defs/ExtBooking"
        }
      ]
    },
    "capacity": {
      "type": "number",
      "format": "float",
      "description": "Booked capacity of employee"
    },
    "startDate": {
      "type": "integer",
      "format": "int32",
      "description": "[DEPRECATED] Start date of the booking. Use startDateIso instead."
    },
    "archivedAt": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "readOnly": true,
      "description": "Archived timestamp for the booking"
    },
    "bookingStatus": {
      "type": "string",
      "enum": [
        "pending",
        "approved",
        "rejected"
      ],
      "description": "Status of the booking. Possible values: ['pending', 'approved', 'rejected']"
    },
    "bookingId": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "readOnly": true,
      "description": "Booking id"
    },
    "demandId": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "description": "Demand id associated with the booking"
    },
    "endDate": {
      "type": "integer",
      "format": "int32",
      "description": "[DEPRECATED] End date of the booking. Use endDateIso instead."
    },
    "updatedAt": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "readOnly": true,
      "description": "Updated timestamp for the booking"
    },
    "employeeProfileId": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "readOnly": true,
      "description": "Profile ID of the employee"
    },
    "bookingType": {
      "type": "string",
      "enum": [
        "demand",
        "leave",
        "optional_holiday",
        "blocker"
      ],
      "description": "Type of the booking. Possible values: ['demand', 'leave', 'optional_holiday', 'blocker']"
    },
    "endDateIso": {
      "type": "string",
      "description": "End date of the booking in ISO format (YYYY-MM-DD)"
    },
    "createdBy": {
      "type": [
        "string",
        "null"
      ],
      "description": "User who created the booking"
    },
    "employeeEmail": {
      "type": "string",
      "description": "Email of employee"
    }
  },
  "required": [
    "bookingStatus",
    "bookingType",
    "capacity",
    "employeeEmail"
  ],
  "$defs": {
    "ExtBooking": {
      "type": "object",
      "properties": {
        "creatorEmail": {
          "type": "string",
          "description": "Email of the creator of the booking"
        },
        "createdAt": {
          "type": "integer",
          "format": "int32",
          "description": "Creation timestamp for the booking"
        },
        "bookingId": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32",
          "readOnly": true,
          "description": "Internal booking ID"
        },
        "startDateIso": {
          "type": "string",
          "description": "Start date of the booking in ISO format (YYYY-MM-DD)"
        },
        "endDateIso": {
          "type": "string",
          "description": "End date of the booking in ISO format (YYYY-MM-DD)"
        },
        "bookedCapacity": {
          "description": "Booked capacity of employee",
          "allOf": [
            {
              "$ref": "#/$defs/ExtBookingCapacityData"
            }
          ]
        },
        "lastModifiedAt": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32",
          "description": "Last modified timestamp for the booking"
        },
        "endDate": {
          "type": "integer",
          "format": "int32",
          "description": "[DEPRECATED] End date of the booking in epoch timestamp format. Use endDateIso instead."
        },
        "lastModifierEmail": {
          "type": [
            "string",
            "null"
          ],
          "description": "Email of the last modifier of the booking"
        },
        "extBookingId": {
          "type": "string",
          "description": "External booking id"
        },
        "startDate": {
          "type": "integer",
          "format": "int32",
          "description": "[DEPRECATED] Start date of the booking in epoch timestamp format. Use startDateIso instead."
        },
        "extDemandId": {
          "type": [
            "string",
            "null"
          ],
          "description": "External demand id for the demand associated with the booking"
        },
        "employeeId": {
          "type": "string",
          "description": "Employee id"
        },
        "bookingStatus": {
          "type": "string",
          "enum": [
            "pending",
            "approved",
            "rejected"
          ],
          "description": "Status of the booking. Possible values: ['pending', 'approved', 'rejected']"
        },
        "bookingType": {
          "type": "string",
          "enum": [
            "demand",
            "leave",
            "optional_holiday",
            "blocker"
          ],
          "description": "Type of the booking. Possible values: ['demand', 'leave', 'optional_holiday', 'blocker']"
        }
      },
      "required": [
        "bookingStatus",
        "bookingType",
        "createdAt",
        "creatorEmail",
        "employeeId",
        "extBookingId"
      ]
    },
    "ExtBookingCapacityData": {
      "type": "object",
      "properties": {
        "unit": {
          "type": "string",
          "enum": [
            "hours",
            "percentage",
            "fraction"
          ],
          "description": "Unit of capacity. Possible values: ['hours', 'percentage', 'fraction']"
        },
        "timeGranularity": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "daily",
            "weekly",
            "monthly"
          ],
          "description": "Time granularity of capacity. Possible values: ['daily', 'weekly', 'monthly']"
        },
        "capacity": {
          "type": "number",
          "format": "float",
          "description": "Capacity value"
        }
      },
      "required": [
        "capacity",
        "unit"
      ]
    }
  }
}