{
  "openapi": "3.0.3",
  "info": {
    "title": "Mal3ab Availability API",
    "version": "0.2.0",
    "description": "Read-only Mal3ab pilot API. Availability covers only onboarded, published courts. No sample data, account data, reservations or payment actions. No Muse listing or approval is implied."
  },
  "paths": {
    "/api/v1/availability": {
      "get": {
        "operationId": "searchCourtAvailability",
        "summary": "Search published court slots in the UAE",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive start, with timezone offset."
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive end. Maximum range: 31 days."
          },
          {
            "name": "sport",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "padel",
                "pickleball",
                "tennis",
                "badminton",
                "basketball",
                "football",
                "cricket",
                "volleyball"
              ]
            }
          },
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current availability, up to 200 slots ordered by start time. A result is not a reservation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "slots",
                    "currency",
                    "priceUnit",
                    "timeZone",
                    "bookingMode",
                    "checkedAt",
                    "sampleData"
                  ],
                  "properties": {
                    "currency": {
                      "type": "string",
                      "enum": [
                        "AED"
                      ]
                    },
                    "priceUnit": {
                      "type": "string",
                      "enum": [
                        "fils"
                      ]
                    },
                    "timeZone": {
                      "type": "string",
                      "enum": [
                        "Asia/Dubai"
                      ]
                    },
                    "bookingMode": {
                      "type": "string",
                      "enum": [
                        "manual_confirmation"
                      ]
                    },
                    "checkedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "slots": {
                      "type": "array",
                      "maxItems": 200,
                      "items": {
                        "$ref": "#/components/schemas/Slot"
                      }
                    },
                    "sampleData": {
                      "type": "boolean",
                      "enum": [
                        false
                      ],
                      "description": "Never returns demonstration inventory."
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or date range."
          },
          "503": {
            "description": "Backend unconfigured or unavailable. Never substitute sample inventory."
          },
          "429": {
            "description": "Rate limit reached. Back off before retrying."
          }
        }
      }
    },
    "/api/connector": {
      "get": {
        "operationId": "getMal3abStatus",
        "summary": "Read product information and current inventory readiness",
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "info"
              ],
              "default": "info"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product, supported sports, backend readiness and number of published courts. Bookings and payments are not available through the connector."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Slot": {
        "type": "object",
        "required": [
          "id",
          "court_id",
          "venue_name",
          "court_name",
          "sport",
          "city",
          "indoor",
          "starts_at",
          "ends_at",
          "price_fils",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "court_id": {
            "type": "string",
            "format": "uuid"
          },
          "venue_name": {
            "type": "string"
          },
          "court_name": {
            "type": "string"
          },
          "sport": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "indoor": {
            "type": "boolean"
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "ends_at": {
            "type": "string",
            "format": "date-time"
          },
          "price_fils": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://mal3ab.apexacademy.cloud"
    }
  ]
}
