openapi: 3.0.0
info:
  title: Baron Coffee Catalog API
  version: 1.0.0
  description: |
    Ukrainian premium coffee brand catalog API.
    
    ## PRODUCT CATEGORIES
    
    ### HORECA (для закладів)
    Coffee for cafes, restaurants, hotels.
    - **Wholesale thresholds**: from 6kg (opt1), from 20kg (opt2)
    - **Products**: Mister Black, Mister Golden, Mister White, Mister Collection
    - **Page**: https://baron.coffee/
    
    ### DRIPS (дріп-кава)
    Drip coffee bags for home brewing.
    - **Wholesale thresholds**: from 2kg (opt1), from 6kg (opt2)
    - **Products**: Individual drip bags in various pack sizes
    - **Page**: https://baron.coffee/drips
    
    ### ELITE (елітна кава)
    Premium single-origin specialty coffee.
    - **Wholesale thresholds**: from 2kg (opt1), from 6kg (opt2)
    - **Products**: Ethiopian Baron, Colombian Baron, specialty coffees
    - **Page**: https://baron.coffee/elite
    
    ## PRICING
    - All prices in UAH (Ukrainian Hryvnia)
    - Wholesale prices calculated by TOTAL WEIGHT in cart
    - Free delivery from 6kg or 4000 UAH
    
    ## PAYMENT
    - Online payment via MonoBank (Visa, Mastercard)
    - Fiscal receipt sent to email

servers:
  - url: https://cysbowekucqfpfxhxort.supabase.co/functions/v1
    description: Production API

paths:
  /public-catalog:
    get:
      operationId: getProductCatalog
      summary: Get full product catalog with prices and wholesale rules
      description: |
        Returns complete catalog with:
        - Brand information
        - All products with variants and prices
        - Wholesale thresholds by category
        - Products grouped by category (products_by_category)
        - Knowledge base content
      parameters:
        - name: category
          in: query
          description: Filter products by category
          required: false
          schema:
            type: string
            enum:
              - horeca
              - drips
              - elite
        - name: format
          in: query
          description: Response format
          required: false
          schema:
            type: string
            enum:
              - json
              - csv
            default: json
      responses:
        '200':
          description: Successful response with product catalog
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    type: string
                    description: Catalog version (date)
                  brand:
                    type: object
                    properties:
                      name:
                        type: string
                      tagline:
                        type: string
                      website:
                        type: string
                  categories:
                    type: object
                    description: Category definitions with wholesale thresholds
                  products_by_category:
                    type: object
                    description: Products explicitly grouped by category
                    properties:
                      horeca:
                        type: object
                        properties:
                          products:
                            type: array
                            items:
                              type: string
                          wholesale_thresholds:
                            type: object
                      drips:
                        type: object
                      elite:
                        type: object
                  products:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        category:
                          type: string
                          enum: [horeca, drips, elite]
                        variants:
                          type: array
                          items:
                            type: object
                            properties:
                              weight:
                                type: string
                              prices:
                                type: object
                                properties:
                                  retail:
                                    type: number
                                  opt1:
                                    type: number
                                  opt2:
                                    type: number
            text/csv:
              schema:
                type: string
        '500':
          description: Server error
