{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "design.schema.json",
  "title": "挪车牌设计存档",
  "description": "design.html「导入设计 / 粘贴 JSON」接受的文件格式。按本 schema 生成的 JSON 可以直接导入；导入时会忽略未知字段，缺失字段按各字段说明处理。",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "style", "font", "numFont", "size", "text", "phones", "qr"],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "可选。本 schema 的地址，设计器导出时自动写入，供编辑器补全和校验，导入时忽略。"
    },
    "schema": {
      "const": "move-car-sign",
      "description": "固定值，不是这个值会导入失败。"
    },
    "style": {
      "description": "配色风格。取值不在列表内时保持设计器当前风格。",
      "oneOf": [
        {"const": "warn", "title": "警示黄黑"},
        {"const": "caution", "title": "警示红白"},
        {"const": "red", "title": "醒目红"},
        {"const": "blue", "title": "宽带蓝"},
        {"const": "navy", "title": "深蓝金"},
        {"const": "green", "title": "清新绿"},
        {"const": "mono", "title": "黑白简约"},
        {"const": "gold", "title": "黑金"},
        {"const": "redgold", "title": "红金"},
        {"const": "pink", "title": "樱花粉"},
        {"const": "lavender", "title": "薰衣草紫"},
        {"const": "rosegold", "title": "玫瑰金"},
        {"const": "mint", "title": "薄荷奶绿"},
        {"const": "midnight", "title": "午夜蓝"},
        {"const": "emerald", "title": "墨绿金"},
        {"const": "milktea", "title": "奶茶"},
        {"const": "sky", "title": "天空蓝"},
        {"const": "peach", "title": "蜜桃橘"},
        {"const": "minimal", "title": "极简白"},
        {"const": "chalk", "title": "校园黑板"},
        {"const": "college", "title": "学院红"},
        {"const": "business", "title": "商务灰"},
        {"const": "carbon", "title": "商务黑银"},
        {"const": "office", "title": "职场青"},
        {"const": "glow", "title": "夜光绿"},
        {"const": "guofeng", "title": "国风朱砂"},
        {"const": "blocks", "title": "积木童趣"},
        {"const": "inverse", "title": "黑白反色"}
      ]
    },
    "font": {
      "description": "标题字体：内置字体用 key 字符串；其它 Google Fonts 字体用 {\"custom\": \"字体名\"}（需支持中文，字体名如 LXGW WenKai TC）。取值无效时保持设计器当前字体。",
      "oneOf": [
        {
          "title": "内置字体",
          "oneOf": [
            {"const": "sans", "title": "思源黑体"},
            {"const": "serif", "title": "思源宋体"},
            {"const": "huangyou", "title": "站酷庆科黄油"},
            {"const": "kuaile", "title": "站酷快乐体"},
            {"const": "mashan", "title": "马善政楷书"},
            {"const": "sys", "title": "系统黑体"},
            {"const": "xiaowei", "title": "站酷小薇体"},
            {"const": "zhimang", "title": "志莽行书"},
            {"const": "liujian", "title": "柳建毛草"},
            {"const": "longcang", "title": "龙藏体"},
            {"const": "wenkai", "title": "霞鹜文楷"},
            {"const": "marker", "title": "霞鹜漫黑"},
            {"const": "goround", "title": "寒蝉圆体"},
            {"const": "chiron", "title": "寒蝉正黑"},
            {"const": "choco", "title": "巧克力黑体"},
            {"const": "cactus", "title": "仙人掌明体"},
            {"const": "lubri", "title": "文道潮黑"}
          ]
        },
        {
          "title": "自定义 Google 字体",
          "type": "object",
          "additionalProperties": false,
          "required": ["custom"],
          "properties": {
            "custom": {"type": "string", "minLength": 1, "description": "Google Fonts 字体名。"}
          }
        }
      ]
    },
    "numFont": {
      "description": "电话号码字体，取值无效时按 follow 处理。",
      "oneOf": [
        {"const": "follow", "title": "跟随标题字体"},
        {"const": "jbmono", "title": "JetBrains Mono"},
        {"const": "robotomono", "title": "Roboto Mono"},
        {"const": "oswald", "title": "Oswald"},
        {"const": "barlow", "title": "Barlow Condensed"},
        {"const": "bebas", "title": "Bebas Neue"},
        {"const": "orbitron", "title": "Orbitron"},
        {"const": "teko", "title": "Teko"},
        {"const": "rajdhani", "title": "Rajdhani"},
        {"const": "chakra", "title": "Chakra Petch"},
        {"const": "saira", "title": "Saira Condensed"},
        {"const": "bigsh", "title": "Big Shoulders"},
        {"const": "anton", "title": "Anton"},
        {"const": "russo", "title": "Russo One"},
        {"const": "archivo", "title": "Archivo Black"},
        {"const": "montserrat", "title": "Montserrat"},
        {"const": "spacemono", "title": "Space Mono"},
        {"const": "plexmono", "title": "IBM Plex Mono"},
        {"const": "bungee", "title": "Bungee"},
        {"const": "audiowide", "title": "Audiowide"},
        {"const": "silkscreen", "title": "Silkscreen"},
        {"const": "bodoni", "title": "Bodoni Moda"},
        {"const": "alfaslab", "title": "Alfa Slab One"},
        {"const": "staatliches", "title": "Staatliches"}
      ]
    },
    "size": {
      "type": "object",
      "additionalProperties": false,
      "description": "牌子尺寸，单位毫米。",
      "required": ["w", "h"],
      "properties": {
        "w": {"type": "number", "minimum": 40, "default": 200, "description": "宽。小于 40 会按 40 处理。"},
        "h": {"type": "number", "minimum": 30, "default": 100, "description": "高。小于 30 会按 30 处理。高大于宽即竖版。"},
        "r": {"type": "number", "minimum": 0, "default": 6, "description": "圆角半径。"},
        "holes": {"type": "boolean", "default": false, "description": "是否在四角画挂孔 / 吸盘孔。"}
      }
    },
    "text": {
      "type": "object",
      "additionalProperties": false,
      "description": "牌子上的文案。标题、副标题、底部提示都可以是空字符串（表示不显示）。",
      "properties": {
        "align": {"enum": ["center", "left"], "default": "center", "description": "文字对齐。"},
        "title": {"type": "string", "default": "", "description": "标题，建议 4 到 12 个字，如「临时停车•请多关照」。"},
        "sub": {"type": "string", "default": "", "description": "副标题，如「需要挪车，请拨打电话」。"},
        "tip": {"type": "string", "maxLength": 16, "default": "", "description": "底部提示，最多 16 个字（建议 8 到 12 个），如「接到电话立即挪车」。超过会被截断。"}
      }
    },
    "phones": {
      "type": "array",
      "minItems": 1,
      "maxItems": 3,
      "description": "电话列表，从上到下排列，最多 3 个，num 为空的项会被忽略。",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["num"],
        "properties": {
          "label": {"type": "string", "maxLength": 8, "default": "", "description": "名称，如「车主」「备用」，可为空。会写进二维码的中转网址时最多保留 8 个字。"},
          "num": {"type": "string", "description": "电话号码，可带空格、横线或 + 区号，如「138 0000 0000」。二维码里只保留数字和 +。空字符串表示这一行不填。"}
        }
      }
    },
    "qr": {
      "type": "object",
      "additionalProperties": false,
      "description": "二维码设置。注意 on 缺失时按 false（不显示二维码）处理。",
      "required": ["on"],
      "properties": {
        "on": {"type": "boolean", "description": "是否显示二维码。"},
        "mode": {
          "enum": ["auto", "image"],
          "default": "auto",
          "description": "auto：由设计器按 type 自动生成；image：使用 image 字段里的图片（如微信二维码截图）。"
        },
        "type": {
          "default": "tel",
          "description": "mode 为 auto 时的二维码类型。tel 和 text 只编码第一个电话；vcard 和 link 包含全部电话；custom 使用 text 字段。",
          "oneOf": [
            {"const": "tel", "title": "tel 拨号，系统相机扫码直接拨号"},
            {"const": "link", "title": "网页中转，微信扫码也能拨号，text 留空时用设计器所在目录的 index.html"},
            {"const": "vcard", "title": "vCard 名片，仅系统相机支持"},
            {"const": "text", "title": "纯文本号码"},
            {"const": "custom", "title": "自定义内容或链接，内容放在 text"}
          ]
        },
        "ec": {
          "enum": ["H", "M"],
          "default": "H",
          "description": "纠错等级。H 更容错但方块更密，内容过长时会自动降为 M。"
        },
        "text": {
          "type": "string",
          "default": "",
          "description": "type 为 custom 时的二维码内容；type 为 link 时是中转页地址（留空用默认地址）；其它类型忽略。"
        },
        "label": {
          "type": "string",
          "default": "",
          "description": "二维码下方说明，可用 \\n 分成多行，如「扫一扫•联系车主」。"
        },
        "image": {
          "type": "string",
          "default": "",
          "pattern": "^(data:image/.*)?$",
          "description": "mode 为 image 时使用的图片，必须是 data:image/ 开头的 data URI，其它值会被当成空。"
        }
      }
    }
  },
  "examples": [
    {
      "schema": "move-car-sign",
      "style": "gold",
      "font": "serif",
      "numFont": "follow",
      "size": {"w": 200, "h": 100, "r": 6, "holes": false},
      "text": {"align": "center", "title": "临时停车•请多关照", "sub": "需要挪车，请拨打电话", "tip": "接到电话立即挪车"},
      "phones": [
        {"label": "车主", "num": "138 0000 0000"},
        {"label": "备用", "num": "139 0000 0000"}
      ],
      "qr": {"on": true, "mode": "auto", "type": "link", "ec": "H", "text": "", "label": "扫一扫•联系车主", "image": ""}
    }
  ]
}
