{
    "openapi": "3.1.0",
    "info": {
        "title": "CandiesWholesaler - Public Read API",
        "version": "1.0.0",
        "description": "Public, read-only access to the product catalog via the WooCommerce Store API. No authentication is required for these endpoints. Ordering is not automated; see /auth.md for how buying works."
    },
    "servers": [
        {
            "url": "https://candieswholesaler.com"
        }
    ],
    "paths": {
        "/wp-json/wc/store/v1/products": {
            "get": {
                "operationId": "listProducts",
                "tags": [
                    "Catalog"
                ],
                "summary": "List products",
                "description": "Public, read-only list of products with prices, stock, images and attributes. Supports full-text search, category filtering and pagination.",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Full-text search across product names and descriptions."
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Filter by product category term ID."
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 10,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 1
                        }
                    },
                    {
                        "name": "orderby",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "date",
                                "price",
                                "popularity",
                                "rating",
                                "title"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A list of products",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Product"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/wp-json/wc/store/v1/products/{id}": {
            "get": {
                "operationId": "getProduct",
                "tags": [
                    "Catalog"
                ],
                "summary": "Get a single product by ID",
                "description": "Public, read-only single product record by numeric product ID.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Numeric product ID.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A product",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Product"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Product not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/wp-json/wc/store/v1/products/categories": {
            "get": {
                "operationId": "listProductCategories",
                "tags": [
                    "Catalog"
                ],
                "summary": "List product categories",
                "description": "Public, read-only list of product categories (name, slug, count and permalink) for browsing the catalog by facet.",
                "responses": {
                    "200": {
                        "description": "A list of product categories",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Category"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "tags": [
        {
            "name": "Catalog",
            "description": "Public, read-only product & category data (WooCommerce Store API)."
        }
    ],
    "components": {
        "schemas": {
            "Product": {
                "type": "object",
                "description": "A single catalog product as returned by the WooCommerce Store API.",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "Unique product ID."
                    },
                    "name": {
                        "type": "string",
                        "description": "Product name."
                    },
                    "permalink": {
                        "type": "string",
                        "format": "uri",
                        "description": "Canonical product URL."
                    },
                    "sku": {
                        "type": "string",
                        "description": "Stock-keeping unit."
                    },
                    "prices": {
                        "type": "object",
                        "description": "Price object with currency minor-unit fields (price, regular_price, sale_price, currency_code)."
                    },
                    "is_in_stock": {
                        "type": "boolean",
                        "description": "Whether the product is currently purchasable."
                    },
                    "short_description": {
                        "type": "string",
                        "description": "Short HTML description."
                    },
                    "images": {
                        "type": "array",
                        "description": "Ordered product images.",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "Category": {
                "type": "object",
                "description": "A product category (facet) for browsing the catalog.",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "Category term ID."
                    },
                    "name": {
                        "type": "string",
                        "description": "Category name."
                    },
                    "slug": {
                        "type": "string",
                        "description": "URL slug."
                    },
                    "description": {
                        "type": "string",
                        "description": "Category description."
                    },
                    "count": {
                        "type": "integer",
                        "description": "Number of published products in the category."
                    },
                    "permalink": {
                        "type": "string",
                        "format": "uri",
                        "description": "Category archive URL."
                    }
                }
            },
            "Error": {
                "type": "object",
                "description": "A WordPress/WooCommerce REST error response.",
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "Machine-readable error code."
                    },
                    "message": {
                        "type": "string",
                        "description": "Human-readable error message."
                    },
                    "data": {
                        "type": "object",
                        "description": "Additional error context (e.g. HTTP status)."
                    }
                }
            }
        }
    }
}