{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "area-chart-schema",
  "title": "Area Chart Schema",
  "description": "Intermediate representation for area chart diagrams. LLM extracts data from natural language into this format, then rendering pipeline generates HTML/SVG from it.",
  "type": "object",
  "required": ["diagramType", "title", "series"],
  "additionalProperties": false,
  "properties": {
    "diagramType": {
      "type": "string",
      "const": "area",
      "description": "Identifies this JSON as an area chart. Must always be 'area'."
    },
    "title": {
      "type": "string",
      "maxLength": 200,
      "description": "Chart title, displayed at the top of the rendered page.",
      "examples": ["Website Traffic Trend", "Monthly Revenue Trend"]
    },
    "subtitle": {
      "type": "string",
      "maxLength": 300,
      "description": "Optional subtitle shown below the title, typically describing the unit or scope.",
      "examples": ["In tens of thousands of visits", "In thousands of USD"]
    },
    "style": {
      "$ref": "schema-shared.json#/$defs/styleEnum",
      "description": "Visual style preset. Each style has its own template and design rules.",
      "default": "dark-professional"
    },
    "format": {
      "$ref": "schema-shared.json#/$defs/formatEnum",
      "description": "Output format. HTML is the default (single-file with inline SVG and CSS). SVG outputs standalone SVG. Mermaid is NOT supported for area charts.",
      "default": "html"
    },
    "density": {
      "type": "string",
      "enum": ["compact", "normal", "spacious"],
      "description": "Layout density. compact=tighter spacing; normal=standard; spacious=generous spacing.",
      "default": "normal"
    },
    "smooth": {
      "type": "boolean",
      "description": "Whether to use smooth Bezier curves (Catmull-Rom interpolation) for area edges. false=straight line segments (default).",
      "default": false
    },
    "variant": {
      "type": "string",
      "enum": ["overlaid", "stacked"],
      "description": "Multi-series arrangement. overlaid=series drawn on top of each other with transparency (default). stacked=series stacked cumulatively.",
      "default": "overlaid"
    },
    "opacity": {
      "type": "number",
      "minimum": 0.1,
      "maximum": 1.0,
      "description": "Fill opacity for area fills. Lower values allow seeing overlapping areas.",
      "default": 0.3
    },
    "series": {
      "type": "array",
      "description": "Data series. Each series contains data points with labels and values. Multiple series are displayed as overlaid or stacked areas.",
      "items": {
        "type": "object",
        "required": ["name", "data"],
        "additionalProperties": false,
        "description": "A data series containing named data points.",
        "properties": {
          "name": {
            "$ref": "schema-shared.json#/$defs/sanitizedString",
            "maxLength": 100,
            "description": "Series name displayed in the legend.",
            "examples": ["Direct", "Social Media", "Revenue"]
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "description": "Optional color override for this series area fill and stroke. Must be 6-digit hex (#RRGGBB). If omitted, uses the chart palette."
          },
          "data": {
            "type": "array",
            "description": "Data points in this series. Each has a label and numeric value.",
            "items": {
              "$ref": "schema-shared.json#/$defs/dataPoint"
            },
            "minItems": 2,
            "maxItems": 30
          }
        }
      },
      "minItems": 1,
      "maxItems": 6
    },
    "axis": {
      "type": "object",
      "description": "Axis configuration for both X and Y axes.",
      "additionalProperties": false,
      "properties": {
        "x": {
          "$ref": "schema-shared.json#/$defs/axisConfig",
          "description": "X-axis configuration (category axis)."
        },
        "y": {
          "$ref": "schema-shared.json#/$defs/axisConfig",
          "description": "Y-axis configuration (value axis)."
        }
      }
    },
    "legend": {
      "$ref": "schema-shared.json#/$defs/legendConfig",
      "description": "Legend configuration. Auto-generated from series names if not provided."
    },
    "colors": {
      "$ref": "schema-shared.json#/$defs/colorsOverride",
      "description": "Optional color overrides for the style's environment colors (background, text, etc.). Does NOT affect data area colors — use series[].color for that."
    },
    "metadata": {
      "$ref": "schema-shared.json#/$defs/metadata",
      "description": "Optional metadata. author field is for internal tracking only and MUST NOT be rendered into the output."
    }
  }
}
