{
  "title": "IMJ UI Design Index",
  "type": "object",
  "required": [
    "schemaVersion",
    "package",
    "version",
    "indexedAt",
    "modules",
    "styleIndex",
    "changelogRetirements",
    "consumerChecklist"
  ],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
    "package": { "type": "string", "const": "@imj_media/ui" },
    "version": { "type": "string" },
    "indexedAt": { "type": "string" },
    "orbitTokensVersion": { "type": "string" },
    "modules": {
      "type": "array",
      "items": { "$ref": "#/$defs/moduleEntry" }
    },
    "styleIndex": { "$ref": "#/$defs/styleIndex" },
    "changelogRetirements": {
      "type": "array",
      "items": { "$ref": "#/$defs/changelogRetirement" }
    },
    "consumerChecklist": {
      "type": "array",
      "items": { "$ref": "#/$defs/consumerChecklistItem" }
    },
    "tokenPalette": { "$ref": "#/$defs/tokenPalette" },
    "themeCssVars": { "$ref": "#/$defs/themeCssVars" }
  },
  "$defs": {
    "mergedDescription": {
      "type": "object",
      "required": ["primary"],
      "properties": {
        "primary": { "enum": ["storybook", "jsdoc", "readme"] },
        "storybook": { "type": "string" },
        "jsdoc": { "type": "string" },
        "readme": { "type": "string" },
        "confidence": { "enum": ["high", "medium", "low"] }
      }
    },
    "propField": {
      "type": "object",
      "required": ["name"],
      "properties": {
        "name": { "type": "string" },
        "type": { "type": "string" },
        "required": { "type": "boolean" },
        "description": { "type": "string" },
        "deprecated": { "type": "boolean" },
        "migrateTo": { "type": "string" }
      }
    },
    "moduleExport": {
      "type": "object",
      "required": ["name", "kind", "description", "examples"],
      "properties": {
        "name": { "type": "string" },
        "kind": {
          "enum": ["component", "hook", "type", "compound-root", "compound-piece", "constant"]
        },
        "description": { "$ref": "#/$defs/mergedDescription" },
        "examples": { "type": "array", "items": { "type": "string" } },
        "props": { "$ref": "#/$defs/exportProps" },
        "demoProps": { "$ref": "#/$defs/demoPropsEntry" }
      }
    },
    "exportProps": {
      "type": "object",
      "properties": {
        "groups": { "type": "object", "additionalProperties": { "type": "object" } },
        "deprecatedRoot": { "type": "array" },
        "flat": { "type": "object" }
      }
    },
    "compositionRecipe": {
      "type": "object",
      "required": ["pieces", "steps", "storyRefs"],
      "properties": {
        "pieces": { "type": "array", "items": { "type": "string" } },
        "steps": { "type": "array", "items": { "type": "string" } },
        "storyRefs": { "type": "array", "items": { "type": "string" } },
        "snippet": { "type": "string" }
      }
    },
    "moduleEntry": {
      "type": "object",
      "required": ["id", "path", "legacy", "compositionType", "exports"],
      "properties": {
        "id": { "type": "string" },
        "path": { "type": "string" },
        "legacy": { "type": "boolean" },
        "legacyReason": { "type": "string" },
        "compositionType": { "enum": [1, 2] },
        "exports": { "type": "array", "items": { "$ref": "#/$defs/moduleExport" } },
        "compositionRecipe": { "$ref": "#/$defs/compositionRecipe" },
        "standaloneSnippet": { "type": "string" },
        "demoProps": { "$ref": "#/$defs/demoPropsEntry" },
        "previewUnavailable": {
          "enum": ["composite", "no_template", "deprecated", "internal_only"]
        },
        "previewScreenshotUrl": { "type": "string" }
      }
    },
    "demoPropsEntry": {
      "type": "object",
      "required": ["props"],
      "properties": {
        "props": { "type": "object" },
        "variants": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["name", "props"],
            "properties": {
              "name": { "type": "string" },
              "props": { "type": "object" }
            }
          }
        }
      }
    },
    "tokenPalette": {
      "type": "object",
      "properties": {
        "colors": { "type": "object" },
        "spacing": { "type": "object" },
        "radius": { "type": "object" },
        "fontSize": { "type": "object" },
        "fontWeight": { "type": "object" },
        "shadow": { "type": "object" }
      }
    },
    "themeCssVars": {
      "type": "object",
      "required": ["light", "dark"],
      "properties": {
        "light": { "type": "object", "additionalProperties": { "type": "string" } },
        "dark": { "type": "object", "additionalProperties": { "type": "string" } }
      }
    },
    "styleIndex": {
      "type": "object",
      "required": ["rules", "tailwindClasses"],
      "properties": {
        "rules": { "type": "array", "items": { "type": "string" } },
        "tailwindClasses": { "type": "array" }
      }
    },
    "changelogRetirement": {
      "type": "object",
      "required": ["version", "note"],
      "properties": {
        "version": { "type": "string" },
        "module": { "type": "string" },
        "export": { "type": "string" },
        "note": { "type": "string" }
      }
    },
    "consumerChecklistItem": {
      "type": "object",
      "required": ["id", "title", "body"],
      "properties": {
        "id": { "type": "string" },
        "title": { "type": "string" },
        "body": { "type": "string" }
      }
    }
  }
}
