{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/user-journey-map/latest.json",
  "description": "解析后的 YML 数据",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/arvinxx/components/master/packages/journey-map/schema/journey-map.schema.json",
    "sourceSha256": "741006785814868824e7eb96b8d97ebbd6d2d37e826951dda011c036c966bc78",
    "fileMatch": [
      "*.jm.yaml",
      "*.jm.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "config": {
      "$ref": "#/$defs/Config",
      "description": "配置参数"
    },
    "stages": {
      "description": "步骤",
      "items": {
        "$ref": "#/$defs/YMLStage"
      },
      "type": "array"
    },
    "title": {
      "description": "标题名",
      "type": "string"
    }
  },
  "required": [
    "stages"
  ],
  "$defs": {
    "Config": {
      "description": "图表配置",
      "properties": {
        "color": {
          "description": "旅程图主色风格",
          "type": "string"
        },
        "height": {
          "$ref": "#/$defs/Partial%3CRecord%3CSectionType,number%3E%3E",
          "description": "每个部分的高度"
        },
        "sections": {
          "description": "待显示的区块\n默认为: ['stage', 'action', 'emotion','thought']",
          "items": {
            "enum": [
              "action",
              "chance",
              "emotion",
              "painPoint",
              "stage",
              "thought"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "title": {
          "description": "显示旅程图标题",
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "Partial<Record<SectionType,number>>": {
      "properties": {
        "action": {
          "type": "number"
        },
        "chance": {
          "type": "number"
        },
        "emotion": {
          "type": "number"
        },
        "painPoint": {
          "type": "number"
        },
        "stage": {
          "type": "number"
        },
        "thought": {
          "type": "number"
        }
      },
      "type": "object"
    },
    "UserAction": {
      "description": "用户行为类型",
      "properties": {
        "color": {
          "description": "展示颜色",
          "type": "string"
        },
        "description": {
          "description": "说明",
          "type": "string"
        },
        "emotion": {
          "description": "情绪得分",
          "maximum": 2,
          "minimum": -2,
          "type": "integer"
        },
        "name": {
          "description": "行为名称",
          "type": "string"
        },
        "painPoints": {
          "description": "痛点",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "thoughts": {
          "description": "想法",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "YMLStage": {
      "description": "YML 的阶段类型",
      "properties": {
        "actions": {
          "description": "该阶段所有用户行为",
          "items": {
            "$ref": "#/$defs/UserAction"
          },
          "type": "array"
        },
        "color": {
          "description": "展示颜色",
          "type": "string"
        },
        "name": {
          "description": "阶段名称",
          "type": "string"
        },
        "painPoints": {
          "description": "痛点",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "thoughts": {
          "description": "想法",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "actions",
        "name"
      ],
      "type": "object"
    }
  }
}
