{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ai.cake20.com/package.schema.json",
  "title": "Cake20 website package.json model",
  "description": "Schema for the visible Cake20 configuration and dependency manifest.",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Local package name before connection; system-managed web-* website ID after first Cake20 deployment."
    },
    "private": {
      "const": true
    },
    "type": {
      "const": "module"
    },
    "packageManager": {
      "type": "string"
    },
    "id": {
      "type": "string",
      "pattern": "^web-[0-9a-f]{12}$",
      "deprecated": true,
      "description": "Legacy field. Do not write it; connected website identity is stored in name."
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "image": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "pattern": "^(https?://|/)"
    },
    "lang": {
      "type": "string",
      "minLength": 2,
      "maxLength": 20
    },
    "favicon": {
      "type": "string",
      "minLength": 1
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone, for example Asia/Seoul."
    },
    "mode": {
      "enum": ["auto", "static", "fullstack"],
      "description": "Website mode. Use static when no server feature is used."
    },
    "data": {
      "enum": ["auto", "local", "server"]
    },
    "device": {
      "enum": ["desktop", "tablet", "mobile"]
    },
    "orientation": {
      "enum": ["landscape", "portrait"]
    },
    "auth": {
      "type": "object",
      "description": "First-level page and API access rules. More specific paths take precedence.",
      "properties": {
        "login": {
          "type": "string",
          "pattern": "^/[^*]*$",
          "default": "/login"
        },
        "denied": {
          "type": "string",
          "pattern": "^/[^*]*$",
          "default": "/403"
        }
      },
      "patternProperties": {
        "^/": {
          "oneOf": [
            { "type": "boolean" },
            { "type": "string", "minLength": 1 },
            {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": { "type": "string", "minLength": 1 }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "dependencies": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "overrides": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "payment": {
      "type": "object",
      "properties": {
        "mode": {
          "enum": ["test", "live"]
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Za-z]{3}$"
        },
        "providers": {
          "type": "array",
          "items": {
            "enum": ["toss", "stripe", "paypal"]
          },
          "uniqueItems": true
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true,
  "x-cake20-source": {
    "form": "JSON object",
    "legacyMigration": ["project.ts", "website.ts", "config.ts", "package.ts"]
  }
}
