{
  "openapi": "3.1.0",
  "info": {
    "title": "Swedelicious Product API",
    "description": "API for accessing Swedish candy product data from Swedelicious. Open to everyone - no authentication required.",
    "version": "1.0.0",
    "contact": {
      "name": "Swedelicious Support",
      "email": "hello@swedelicious.net",
      "url": "https://swedelicious.net/contact"
    }
  },
  "servers": [
    {
      "url": "https://bwaqusevwjqgsltwrhnf.supabase.co/functions/v1",
      "description": "Swedelicious API"
    }
  ],
  "paths": {
    "/products-json": {
      "get": {
        "operationId": "getProducts",
        "summary": "Get all products",
        "description": "Returns a list of all active Swedish candy products with full details including pricing, nutrition, and brand information.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of products to return",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Number of products to skip",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Filter by category slug",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "brand",
            "in": "query",
            "description": "Filter by brand slug",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "featured",
            "in": "query",
            "description": "Only return featured products",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with product list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "products": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/product-json": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get single product",
        "description": "Returns detailed information about a specific product by slug.",
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "required": true,
            "description": "Product slug identifier",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          }
        }
      }
    },
    "/ai-resources": {
      "get": {
        "operationId": "getAIResources",
        "summary": "Get AI-optimized resources",
        "description": "Returns AI-friendly data including products, brands, categories, and ordering information.",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "description": "Specific resource path (products.json, brands.json, categories.json, ordering.json)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AI resource data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "brand": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "weight_grams": {
            "type": "number"
          },
          "price_sek": {
            "type": "number"
          },
          "image_url": {
            "type": "string"
          },
          "ingredients": {
            "type": "string"
          },
          "nutritional_info": {
            "type": "object"
          },
          "is_vegan": {
            "type": "boolean"
          },
          "is_gluten_free": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
