{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "./design-tokens.schema.json",
  "title": "TipSharks Design Tokens Schema",
  "description": "JSON Schema for validating TipSharks design tokens",
  "type": "object",
  "required": ["name", "version", "tokens"],
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of the design system"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Semantic version of the tokens"
    },
    "tokens": {
      "type": "object",
      "description": "Design token categories",
      "required": ["color", "spacing", "borderRadius", "typography"],
      "properties": {
        "color": {
          "type": "object",
          "description": "Color tokens",
          "required": ["brand", "semantic", "text", "background"],
          "properties": {
            "brand": {
              "type": "object",
              "additionalProperties": { "$ref": "#/definitions/token" }
            },
            "semantic": {
              "type": "object",
              "additionalProperties": { "$ref": "#/definitions/token" }
            },
            "text": {
              "type": "object",
              "additionalProperties": { "$ref": "#/definitions/token" }
            },
            "background": {
              "type": "object",
              "additionalProperties": { "$ref": "#/definitions/token" }
            }
          }
        },
        "spacing": {
          "type": "object",
          "additionalProperties": { "$ref": "#/definitions/token" }
        },
        "borderRadius": {
          "type": "object",
          "additionalProperties": { "$ref": "#/definitions/token" }
        },
        "typography": {
          "type": "object",
          "description": "Typography tokens",
          "properties": {
            "fontFamily": {
              "type": "object",
              "additionalProperties": { "$ref": "#/definitions/token" }
            },
            "fontSize": {
              "type": "object",
              "additionalProperties": { "$ref": "#/definitions/token" }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "token": {
      "type": "object",
      "required": ["value"],
      "properties": {
        "value": {
          "type": "string",
          "description": "The token value"
        },
        "description": {
          "type": "string",
          "description": "Human-readable description of the token"
        }
      },
      "additionalProperties": false
    }
  }
}
