{
  "openapi": "3.0.3",
  "info": {
    "title": "Manglam Everyday B2B Catalog API",
    "description": "Public API endpoints for searching and browsing wholesale products, categories, and verified manufacturers on Manglam Everyday.",
    "version": "1.0.0",
    "contact": {
      "name": "Manglam Everyday API Support",
      "url": "https://dev-mangalameveryday.vercel.app/contact",
      "email": "grievance@manglam.com"
    }
  },
  "servers": [
    {
      "url": "https://dev-mangalameveryday.vercel.app/api/v1",
      "description": "Production API Server"
    }
  ],
  "paths": {
    "/products": {
      "get": {
        "summary": "Search and list wholesale products",
        "description": "Returns a paginated list of wholesale products with tiered MOQ pricing and category filtering.",
        "operationId": "getProducts",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "Keyword search across product titles, descriptions, and tags",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Filter by product category slug or ID",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number for pagination",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Number of items per page",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful list of products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "totalPages": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/products/{slug}": {
      "get": {
        "summary": "Get wholesale product details",
        "description": "Fetch detailed product specifications, MOQ tiers, manufacturer profile, and shipping estimates by product slug.",
        "operationId": "getProductBySlug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Unique product slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "404": {
            "description": "Product not found"
          }
        }
      }
    },
    "/products/search/recommendations": {
      "get": {
        "summary": "Autocomplete search suggestions",
        "description": "Returns autocomplete suggestions and trending search keywords.",
        "operationId": "getSearchRecommendations",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Search keyword prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search suggestions array",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "currency": {
            "type": "string",
            "example": "INR"
          },
          "minOrderQuantity": {
            "type": "integer"
          },
          "inStock": {
            "type": "boolean"
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
