{
  "openapi": "3.1.0",
  "info": {
    "title": "Silky Hair AI Beauty Advisor API",
    "description": "Chat with Naledi, the AI beauty advisor for Silky Hair (silkyhair.co.za). Search in-stock human-hair wigs and get personalised recommendations. All prices in ZAR.",
    "version": "1.0.0"
  },
  "servers": [
    { "url": "https://silky-hair-advisor.replit.app/api", "description": "Production API" }
  ],
  "paths": {
    "/chat": {
      "post": {
        "operationId": "askNaledi",
        "summary": "Ask Naledi for wig recommendations",
        "description": "Send a customer message to Naledi, the AI beauty advisor. She will respond with personalised recommendations from the live Silky Hair catalog, including product titles, prices, and checkout URLs.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["message", "sessionId"],
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "The customer's question or preference",
                    "example": "I want a body wave frontal wig, around 22 inches"
                  },
                  "sessionId": {
                    "type": "string",
                    "description": "Unique session identifier (generate a UUID per conversation)",
                    "example": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                  },
                  "history": {
                    "type": "array",
                    "description": "Previous conversation messages for context",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": { "type": "string", "enum": ["user", "assistant"] },
                        "content": { "type": "string" }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Naledi's reply with recommended products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reply": {
                      "type": "string",
                      "description": "Naledi's conversational response"
                    },
                    "recommendedProducts": {
                      "type": "array",
                      "description": "Up to 3 specific product recommendations",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "title": { "type": "string" },
                          "priceFrom": { "type": "string", "description": "Starting price in ZAR" },
                          "currency": { "type": "string", "example": "ZAR" },
                          "url": { "type": "string", "description": "Direct checkout URL on silkyhair.co.za" },
                          "image": { "type": "string", "description": "Product image URL" },
                          "available": { "type": "boolean" }
                        }
                      }
                    },
                    "suggestions": {
                      "type": "array",
                      "items": { "type": "string" },
                      "description": "Follow-up question suggestions"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/products/live": {
      "get": {
        "operationId": "getLiveProducts",
        "summary": "Get all in-stock Silky Hair products",
        "description": "Returns the full live product catalog synced from Shopify, filtered to in-stock items.",
        "responses": {
          "200": {
            "description": "Live product list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": { "type": "number" },
                    "products": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "title": { "type": "string" },
                          "priceFrom": { "type": "string" },
                          "currency": { "type": "string" },
                          "url": { "type": "string" },
                          "image": { "type": "string" },
                          "available": { "type": "boolean" },
                          "tags": { "type": "array", "items": { "type": "string" } }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
