{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opengastronomy.org/schema/v0.4/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",
        "spirit",
        "cider",
        "sake",
        "other"
      ],
      "description": "Broad beverage category."
    },
    "subtype": {
      "type": "string",
      "description": "Specific subtype, e.g. red, white, sparkling, rosé, ipa, stout."
    },
    "grape_varieties": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Grape varieties (for wine)."
    },
    "vintage": {
      "type": "integer",
      "description": "Harvest year."
    },
    "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."
    },
    "serve_temperature_c": {
      "type": "object",
      "properties": {
        "min": {
          "type": "number"
        },
        "max": {
          "type": "number"
        }
      },
      "additionalProperties": false,
      "description": "Recommended serving temperature range in degrees Celsius.",
      "patternProperties": {
        "^x-": true
      }
    },
    "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
}
