{
  "openapi": "3.0.0",
  "info": {
    "title": "Shabab Al Yola API",
    "description": "API endpoints for product searches, user assistant, and health checking.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://www.shababalyola.ae",
      "description": "Production Server"
    }
  ],
  "paths": {
    "/api/status": {
      "get": {
        "summary": "Check API health status",
        "description": "Returns the status and health info of the server.",
        "responses": {
          "200": {
            "description": "Successful health check response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "timestamp": {
                      "type": "integer",
                      "example": 1780000000000
                    },
                    "uptime": {
                      "type": "number",
                      "example": 12.34
                    },
                    "env": {
                      "type": "string",
                      "example": "production"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/products/search": {
      "post": {
        "summary": "Search products",
        "description": "Search products in catalog using query, category, season, color, subcategory, and price range filters.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Free text query to search across name, sku, category, season, etc."
                  },
                  "category": {
                    "type": "string",
                    "description": "Optional category filter (e.g. kandora, thobe, bisht)"
                  },
                  "color": {
                    "type": "string",
                    "description": "Optional color filter (e.g. white, black, beige)"
                  },
                  "season": {
                    "type": "string",
                    "description": "Optional season filter (e.g. summer, winter)"
                  },
                  "subcategory": {
                    "type": "string",
                    "description": "Optional subcategory filter"
                  },
                  "minPrice": {
                    "type": "number",
                    "description": "Minimum product price"
                  },
                  "maxPrice": {
                    "type": "number",
                    "description": "Maximum product price"
                  },
                  "limit": {
                    "type": "integer",
                    "default": 5,
                    "maximum": 10,
                    "description": "Maximum number of items to return"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search results returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "count": {
                      "type": "integer",
                      "example": 1
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 1
                          },
                          "sku": {
                            "type": "string",
                            "example": "KND-OFF-WHITE"
                          },
                          "name": {
                            "type": "string",
                            "example": "Off-white Emirati Kandura"
                          },
                          "price": {
                            "type": "number",
                            "example": 250
                          },
                          "discountedPrice": {
                            "type": "number",
                            "nullable": true,
                            "example": 220
                          },
                          "offerLabel": {
                            "type": "string",
                            "nullable": true,
                            "example": "12% OFF"
                          },
                          "color": {
                            "type": "string",
                            "example": "white"
                          },
                          "category": {
                            "type": "string",
                            "example": "kandora"
                          },
                          "categorySlug": {
                            "type": "string",
                            "example": "kandora"
                          },
                          "season": {
                            "type": "string",
                            "example": "summer"
                          },
                          "subcategory": {
                            "type": "string",
                            "example": "emirati"
                          },
                          "image": {
                            "type": "string",
                            "example": "https://pub-ce7da8061d0f411ba010b84ef5f6beb8.r2.dev/images/off-white.webp"
                          },
                          "routePath": {
                            "type": "string",
                            "example": "/collections/kandora/off-white-emirati-kandora"
                          },
                          "collectionPath": {
                            "type": "string",
                            "example": "/collections/kandora"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
