{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opengastronomy.org/schema/v0.5/beverage.schema.json",
  "title": "OGS Beverage",
  "description": "A wine, beer, spirit, or other beverage with typology, structural attributes, and sensory profile. See spec/ogs-comp.md §8 and spec/ogs-sense.md.",
  "type": "object",
  "required": [
    "id",
    "ogs_version",
    "name",
    "type",
    "sensory_profile"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^ogs:[a-z0-9-]+:beverage:[a-z0-9-]+$",
      "description": "OGS identifier: ogs:<namespace>:beverage:<id>."
    },
    "ogs_version": {
      "$ref": "common.schema.json#/$defs/ogs_version"
    },
    "primary_language": {
      "$ref": "common.schema.json#/$defs/primary_language"
    },
    "available_languages": {
      "$ref": "common.schema.json#/$defs/available_languages"
    },
    "name": {
      "$ref": "common.schema.json#/$defs/lstring",
      "description": "Human-readable beverage name."
    },
    "description": {
      "$ref": "common.schema.json#/$defs/lstring",
      "description": "Longer description of the beverage."
    },
    "type": {
      "type": "string",
      "enum": [
        "wine",
        "beer",
        "cider",
        "mead",
        "sake",
        "spirit",
        "cocktail",
        "coffee",
        "tea",
        "infusion",
        "juice",
        "soft_drink",
        "kombucha",
        "water",
        "other"
      ],
      "description": "Broad beverage category (vocab/beverage_types.json). Coffee, tea, infusions, juices, soft drinks, kombucha and water are new in v0.5."
    },
    "kind": {
      "type": "string",
      "enum": [
        "product",
        "style"
      ],
      "description": "product: a specific bottle or SKU. style: a category such as 'young Barolo' or 'dry Riesling' that recommendations name (new in v0.5)."
    },
    "subtype": {
      "type": "string",
      "description": "Specific subtype, e.g. red, white, sparkling, rosé, ipa, stout."
    },
    "grape_varieties": {
      "type": "array",
      "description": "Grape varieties (for wine). From v0.5 an item may give the variety's share of the blend.",
      "items": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "required": [
              "variety"
            ],
            "properties": {
              "variety": {
                "type": "string",
                "minLength": 1
              },
              "share": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "patternProperties": {
              "^x-": true
            },
            "additionalProperties": false
          }
        ]
      }
    },
    "vintage": {
      "description": "Harvest year, or \"NV\" for a non-vintage blend (new in v0.5).",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "const": "NV"
        }
      ]
    },
    "region": {
      "$ref": "common.schema.json#/$defs/lstring",
      "description": "Production region."
    },
    "appellation": {
      "$ref": "common.schema.json#/$defs/lstring",
      "description": "Official appellation or denomination."
    },
    "producer": {
      "$ref": "common.schema.json#/$defs/lstring",
      "description": "Producer or winery name."
    },
    "abv": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Alcohol by volume, percent."
    },
    "residual_sugar": {
      "type": "number",
      "minimum": 0,
      "description": "Residual sugar, g/L."
    },
    "style": {
      "type": "object",
      "description": "Controlled style attributes (new in v0.5). See spec/ogs-comp.md §8.1.",
      "properties": {
        "color": {
          "type": "string",
          "enum": [
            "red",
            "white",
            "rose",
            "orange",
            "amber",
            "tawny"
          ],
          "description": "Wine colour; 'orange' is skin-contact white wine."
        },
        "sweetness": {
          "type": "string",
          "enum": [
            "dry",
            "off_dry",
            "medium_sweet",
            "sweet",
            "luscious"
          ],
          "description": "Perceived sweetness band."
        },
        "dosage": {
          "type": "string",
          "enum": [
            "brut_nature",
            "extra_brut",
            "brut",
            "extra_dry",
            "dry",
            "demi_sec",
            "doux"
          ],
          "description": "Sparkling wine dosage category."
        },
        "methods": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z_]*$"
          },
          "uniqueItems": true,
          "description": "Production methods (vocab/beverage_methods.json), checked at L2."
        },
        "tea_type": {
          "type": "string",
          "enum": [
            "white",
            "green",
            "yellow",
            "oolong",
            "black",
            "dark",
            "herbal"
          ],
          "description": "Tea category ('dark' covers pu-erh)."
        },
        "roast_level": {
          "type": "string",
          "enum": [
            "light",
            "medium",
            "medium_dark",
            "dark"
          ],
          "description": "Coffee roast level."
        },
        "ibu": {
          "type": "number",
          "minimum": 0,
          "description": "Beer bitterness, International Bitterness Units."
        },
        "base": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "description": "For a cocktail: base spirits or main components, as free text (mixing specifications stay out of scope)."
        }
      },
      "patternProperties": {
        "^x-": true
      },
      "additionalProperties": false
    },
    "serve_temperature_c": {
      "$ref": "common.schema.json#/$defs/temperature_range_c",
      "description": "Recommended serving temperature range in degrees Celsius."
    },
    "sensory_profile": {
      "$ref": "common.schema.json#/$defs/sensory_profile"
    },
    "notes": {
      "$ref": "common.schema.json#/$defs/lstring",
      "description": "Additional tasting notes or comments."
    },
    "dietary": {
      "$ref": "common.schema.json#/$defs/dietary"
    },
    "metadata": {
      "$ref": "common.schema.json#/$defs/metadata"
    }
  },
  "additionalProperties": true
}
