{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://dss.overbits.luz.uy/schemas/components.schema.json",
  "title": "Components Schema",
  "description": "Schema for design system components (atomic design)",
  "version": "2.0.0",
  "x-immutable-notice": {
    "protected": true,
    "reason": "Component structure specification - maintains atomic design hierarchy integrity",
    "lastModified": "2025-12-09",
    "bypassMethod": "Use 'DSS_IMMUTABLE_BYPASS=1 git commit' or commit message '[IMMUTABLE-UPDATE] reason'"
  },
  "type": "object",
  "properties": {
    "components": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/component"
      }
    }
  },
  "definitions": {
    "component": {
      "type": "object",
      "required": ["name", "type", "path"],
      "properties": {
        "name": {
          "type": "string",
          "description": "Component name"
        },
        "type": {
          "type": "string",
          "enum": ["atom", "molecule", "composite", "template", "page"],
          "description": "Atomic design level (composite = complex multi-molecule component)"
        },
        "path": {
          "type": "string",
          "description": "File path relative to project root"
        },
        "description": {
          "type": "string",
          "description": "Component purpose and usage"
        },
        "tokens": {
          "type": "array",
          "description": "Design tokens used by this component",
          "items": {
            "type": "string"
          }
        },
        "props": {
          "type": "object",
          "description": "Component properties/props",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "type": {"type": "string"},
              "required": {"type": "boolean"},
              "default": {},
              "description": {"type": "string"}
            }
          }
        },
        "variants": {
          "type": "array",
          "description": "Component variants",
          "items": {
            "type": "object",
            "properties": {
              "name": {"type": "string"},
              "props": {"type": "object"}
            }
          }
        },
        "dependencies": {
          "type": "array",
          "description": "Other components this depends on",
          "items": {
            "type": "string"
          }
        },
        "storybook": {
          "type": "object",
          "description": "Storybook configuration",
          "properties": {
            "stories": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
