{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://bazaaron.ai/schemas/recipe-ingredient-match.json",
  "title": "Recipe Ingredient Match",
  "description": "Maps free-text recipe ingredients to purchasable catalog products.",
  "type": "object",
  "properties": {
    "request": {
      "type": "object",
      "required": [
        "ingredients"
      ],
      "properties": {
        "ingredients": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Recipe ingredient lines, e.g. '2 cups basmati rice'."
        }
      }
    },
    "response": {
      "type": "object",
      "required": [
        "capability",
        "matches"
      ],
      "properties": {
        "capability": {
          "const": "ai.bazaaron.shopping.recipe_ingredient_match"
        },
        "matches": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "ingredient",
              "products"
            ],
            "properties": {
              "ingredient": {
                "type": "string"
              },
              "products": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "priceCents": {
                      "type": "integer"
                    },
                    "storeName": {
                      "type": "string"
                    },
                    "inventory": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}