{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opengastronomy.org/schema/v0.3/dish.schema.json",
  "title": "OGS Dish",
  "description": "A composed dish with components, cooking methods, and overall sensory profile. See spec/ogs-comp.md.",
  "type": "object",
  "required": ["id", "ogs_version", "name", "components", "overall_sensory_profile"],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^ogs:[a-z0-9-]+:dish:[a-z0-9-]+$",
      "description": "OGS identifier: ogs:<namespace>:dish:<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 dish name." },
    "description": { "$ref": "common.schema.json#/$defs/lstring", "description": "Longer description of the dish." },
    "cuisine": {
      "type": "string",
      "minLength": 1,
      "description": "Cuisine reference (ogs:<namespace>:cuisine:<id>). Free text is accepted for v0.1 compatibility but does not meet L2."
    },
    "course": {
      "type": "string",
      "enum": ["amuse", "appetizer", "soup", "salad", "fish", "main", "cheese", "dessert", "petit_four"],
      "description": "Course position in a meal."
    },
    "service_temperature": {
      "type": "string",
      "enum": ["frozen", "cold", "cool", "room", "warm", "hot", "very_hot"],
      "description": "Intended serving temperature."
    },
    "components": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/component" },
      "description": "Dish components with roles and cooking methods. See spec/ogs-comp.md §6."
    },
    "overall_sensory_profile": {
      "$ref": "common.schema.json#/$defs/sensory_profile",
      "description": "Sensory profile of the finished dish."
    },
    "notes": { "$ref": "common.schema.json#/$defs/lstring" },
    "metadata": { "$ref": "common.schema.json#/$defs/metadata" }
  },
  "additionalProperties": true,
  "$defs": {
    "component": {
      "type": "object",
      "required": ["role", "ingredient_ref"],
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "main_protein", "main_vegetable", "starch", "sauce",
            "fat_component", "acid_component", "aromatic_garnish",
            "seasoning", "textural_element"
          ],
          "description": "Component role (vocab/component_roles.json)."
        },
        "ingredient_ref": {
          "type": "string",
          "pattern": "^ogs:[a-z0-9-]+:ingredient:[a-z0-9-]+$",
          "description": "Reference to an OGS ingredient."
        },
        "cooking_method": {
          "type": "string",
          "enum": [
            "raw", "seared", "grilled", "roasted", "braised", "poached",
            "steamed", "fried", "confit", "smoked", "fermented", "cured",
            "pickled", "dehydrated", "sous_vide", "blanched", "sauteed",
            "baked", "charred", "emulsified"
          ],
          "description": "Cooking method (vocab/cooking_methods.json)."
        },
        "maillard_index": { "type": "integer", "minimum": 0, "maximum": 5, "description": "Degree of browning, 0-5. See spec/ogs-comp.md §4." },
        "reduction_level": { "type": "integer", "minimum": 0, "maximum": 5, "description": "Concentration of liquids, 0-5. See spec/ogs-comp.md §5." },
        "proportion": {
          "type": "string",
          "enum": ["dominant", "significant", "accent", "trace"],
          "description": "Relative share of the dish. See spec/ogs-comp.md §6.2."
        },
        "sensory_contribution": {
          "$ref": "common.schema.json#/$defs/sensory_profile",
          "description": "Partial sensory profile describing this component's contribution."
        }
      },
      "additionalProperties": true
    }
  }
}
