{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kiwe.local/schemas/kiwe.framework-profile.v1.json",
  "title": "Kiwe Framework Profile",
  "description": "Standalone Kiwe Framework design-token profile. Imports under Kiwe > Framework and contains settings.tokens only.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "settings"
  ],
  "properties": {
    "type": {
      "const": "kiwe-framework-profile"
    },
    "schema": {
      "const": "kiwe.framework-profile.v1"
    },
    "schemaVersion": {
      "type": "integer",
      "minimum": 1
    },
    "pluginVersion": {
      "type": "string"
    },
    "exportedAt": {
      "type": "string"
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "siteName": {
          "type": "string"
        },
        "siteUrl": {
          "type": "string"
        }
      }
    },
    "settings": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "tokens"
      ],
      "properties": {
        "tokens": {
          "$ref": "#/$defs/tokens"
        }
      }
    }
  },
  "$defs": {
    "tokens": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "enabled",
        "profile_label",
        "overrides",
        "bricks_theme_style"
      ],
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "profile_label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "overrides": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "number"
            ]
          },
          "propertyNames": {
            "pattern": "^[a-z0-9][a-z0-9-]{0,79}$"
          }
        },
        "bricks_theme_style": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "enabled",
            "id",
            "label"
          ],
          "properties": {
            "enabled": {
              "const": true
            },
            "id": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
            },
            "label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "siteBackground": {
              "type": "string"
            },
            "site_background": {
              "type": "string"
            },
            "background": {
              "type": "string"
            },
            "colorPrimary": {
              "type": "string"
            },
            "color_primary": {
              "type": "string"
            },
            "primary": {
              "type": "string"
            },
            "brand": {
              "type": "string"
            },
            "colorSecondary": {
              "type": "string"
            },
            "color_secondary": {
              "type": "string"
            },
            "secondary": {
              "type": "string"
            },
            "accent": {
              "type": "string"
            },
            "colorSurface": {
              "type": "string"
            },
            "color_surface": {
              "type": "string"
            },
            "surface": {
              "type": "string"
            },
            "colorSurfaceRaised": {
              "type": "string"
            },
            "color_surface_raised": {
              "type": "string"
            },
            "surfaceRaised": {
              "type": "string"
            },
            "colorLight": {
              "type": "string"
            },
            "color_light": {
              "type": "string"
            },
            "light": {
              "type": "string"
            },
            "colorDark": {
              "type": "string"
            },
            "color_dark": {
              "type": "string"
            },
            "dark": {
              "type": "string"
            },
            "colorMuted": {
              "type": "string"
            },
            "color_muted": {
              "type": "string"
            },
            "muted": {
              "type": "string"
            },
            "colorBorder": {
              "type": "string"
            },
            "color_border": {
              "type": "string"
            },
            "borderColor": {
              "type": "string"
            },
            "border_color": {
              "type": "string"
            },
            "linkColor": {
              "type": "string"
            },
            "link_color": {
              "type": "string"
            },
            "colorLink": {
              "type": "string"
            },
            "color_link": {
              "type": "string"
            },
            "linkHoverColor": {
              "type": "string"
            },
            "link_hover_color": {
              "type": "string"
            },
            "fontDisplay": {
              "type": "string"
            },
            "font_display": {
              "type": "string"
            },
            "displayFont": {
              "type": "string"
            },
            "display_font": {
              "type": "string"
            },
            "fontBody": {
              "type": "string"
            },
            "font_body": {
              "type": "string"
            },
            "bodyFont": {
              "type": "string"
            },
            "body_font": {
              "type": "string"
            },
            "typeH1": {
              "type": "string"
            },
            "type_h1": {
              "type": "string"
            },
            "typeH2": {
              "type": "string"
            },
            "type_h2": {
              "type": "string"
            },
            "typeBody": {
              "type": "string"
            },
            "type_body": {
              "type": "string"
            },
            "radiusLg": {
              "type": "string"
            },
            "radius_lg": {
              "type": "string"
            },
            "radiusLarge": {
              "type": "string"
            },
            "radius_large": {
              "type": "string"
            },
            "shadowMd": {
              "type": "string"
            },
            "shadow_md": {
              "type": "string"
            },
            "shadowMedium": {
              "type": "string"
            },
            "shadow_medium": {
              "type": "string"
            },
            "spaceMd": {
              "type": "string"
            },
            "space_md": {
              "type": "string"
            }
          }
        },
        "project": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "id": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9_-]{0,59}$"
            },
            "label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "variables": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/projectVariable"
              }
            },
            "classes": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/projectClass"
              }
            }
          }
        }
      }
    },
    "projectVariable": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "value"
      ],
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^--(?!kiwe-|seam-)[a-z][a-z0-9]*-[a-z0-9][a-z0-9_-]{0,80}$"
        },
        "variable": {
          "type": "string",
          "pattern": "^--(?!kiwe-|seam-)[a-z][a-z0-9]*-[a-z0-9][a-z0-9_-]{0,80}$"
        },
        "key": {
          "type": "string",
          "pattern": "^--(?!kiwe-|seam-)[a-z][a-z0-9]*-[a-z0-9][a-z0-9_-]{0,80}$"
        },
        "value": {
          "type": [
            "string",
            "number"
          ]
        },
        "type": {
          "type": "string"
        },
        "behavior": {
          "enum": [
            "fixed-primitive",
            "fluid-scale",
            "geometry-input",
            "content-limit",
            "responsive-guard",
            "semantic-token",
            "alias",
            "layer-token",
            "project-token"
          ]
        },
        "category": {
          "type": "string",
          "maxLength": 80
        },
        "description": {
          "type": "string",
          "maxLength": 180
        }
      }
    },
    "projectClass": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{4,79}$"
        },
        "name": {
          "type": "string",
          "pattern": "^(?!(?:kiwe|seam)-)(?:[a-z][a-z0-9]{1,12})-[a-z0-9][a-z0-9_-]{1,80}$"
        },
        "category": {
          "type": "string",
          "maxLength": 80
        },
        "description": {
          "type": "string",
          "maxLength": 180
        },
        "settings": {
          "type": "object"
        }
      }
    }
  },
  "not": {
    "anyOf": [
      { "required": [ "dock" ] },
      { "required": [ "style" ] },
      { "required": [ "screens" ] },
      { "required": [ "theme_screens" ] },
      { "required": [ "dsa_theme" ] },
      { "required": [ "visual_effects" ] },
      { "required": [ "commerce" ] },
      { "required": [ "bricks" ] },
      { "required": [ "css" ] },
      { "required": [ "html" ] }
    ]
  }
}
