{
  "openapi": "3.0.3",
  "info": {
    "title": "Gemmari Coffee Recommendation API",
    "version": "1.0.0",
    "description": "Recommends a Gemmari coffee from three public quiz criteria. No account, personal data or pricing rules are required."
  },
  "servers": [
    {
      "url": "https://www.gemmari.com"
    }
  ],
  "paths": {
    "/api/ai/recommend-coffee": {
      "get": {
        "summary": "Describe the recommendation API",
        "responses": {
          "200": {
            "description": "Supported criteria and an example request"
          }
        }
      },
      "post": {
        "summary": "Recommend a coffee",
        "operationId": "recommendCoffee",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecommendationCriteria"
              },
              "example": {
                "intensity": "balanced",
                "notes": "chocolate",
                "roast": "balanced"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recommended coffee",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecommendationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid criteria"
          },
          "429": {
            "description": "Recommendation rate limit reached"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RecommendationCriteria": {
        "type": "object",
        "required": [
          "intensity",
          "notes",
          "roast"
        ],
        "properties": {
          "intensity": {
            "type": "string",
            "enum": [
              "light",
              "balanced",
              "strong"
            ]
          },
          "notes": {
            "type": "string",
            "enum": [
              "floral",
              "chocolate",
              "roasted"
            ]
          },
          "roast": {
            "type": "string",
            "enum": [
              "light",
              "balanced",
              "dark"
            ]
          }
        },
        "additionalProperties": false
      },
      "RecommendationResponse": {
        "type": "object",
        "required": [
          "algorithmVersion",
          "recommendation"
        ],
        "properties": {
          "algorithmVersion": {
            "type": "string"
          },
          "recommendation": {
            "type": "object",
            "required": [
              "slug",
              "name",
              "roast",
              "path"
            ],
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "roast": {
                "type": "string"
              },
              "path": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
