{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "line-chart-schema",
  "title": "Line Chart Schema",
  "description": "Intermediate representation for line 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": "line",
      "description": "Identifies this JSON as a line chart. Must always be 'line'."
    },
    "title": {
      "type": "string",
      "maxLength": 200,
      "description": "Chart title, displayed at the top of the rendered page.",
      "examples": ["Monthly Active Users", "Monthly Active Users 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 people", "Trend over 6 months"]
    },
    "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 uses xychart-beta syntax (experimental).",
      "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 instead of straight line segments. When true, Catmull-Rom to Bezier conversion is applied.",
      "default": false
    },
    "series": {
      "type": "array",
      "description": "Data series. Each series contains data points with labels and values. All series must share the same X-axis labels.",
      "items": {
        "type": "object",
        "required": ["name", "data"],
        "additionalProperties": false,
        "properties": {
          "name": {
            "$ref": "schema-shared.json#/$defs/sanitizedString",
            "maxLength": 100,
            "description": "Series name displayed in the legend.",
            "examples": ["Users", "Users", "Revenue"]
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "description": "Optional color override for the line and data points. Must be 6-digit hex (#RRGGBB). If omitted, uses the chart palette."
          },
          "lineWidth": {
            "type": "number",
            "minimum": 1,
            "maximum": 5,
            "description": "Line stroke width in pixels.",
            "default": 2.5
          },
          "lineStyle": {
            "type": "string",
            "enum": ["solid", "dashed"],
            "description": "Line stroke style. solid=continuous line; dashed=dashed line pattern.",
            "default": "solid"
          },
          "dataPointShape": {
            "type": "string",
            "enum": ["circle", "square", "diamond", "none"],
            "description": "Shape of data point markers. none=no markers drawn.",
            "default": "circle"
          },
          "data": {
            "type": "array",
            "description": "Data points in this series. Each has a label and numeric value. All series must have the same labels.",
            "items": {
              "$ref": "schema-shared.json#/$defs/dataPoint"
            },
            "minItems": 2,
            "maxItems": 30
          }
        }
      },
      "minItems": 1,
      "maxItems": 8
    },
    "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). Default gridLines=true for line charts."
        }
      }
    },
    "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 line 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."
    }
  }
}
