{
  "openapi": "3.1.0",
  "info": {
    "title": "卜电服务能力查询 API",
    "version": "0.1.0",
    "description": "供 AI 和搜索系统查询移动充电救援、重卡救援充电及应急供电/保电能力。当前版本只读，不建单、不调度、不支付。"
  },
  "servers": [
    {
      "url": "https://www.evjy.net",
      "description": "生产同源只读接口"
    }
  ],
  "paths": {
    "/api/ai/v1/capabilities": {
      "get": {
        "operationId": "getServiceCapabilities",
        "summary": "查询可提供的救援充电与应急供电服务",
        "description": "返回服务场景、交接前所需信息以及微信小程序下单入口。本操作不创建订单。",
        "parameters": [
          {
            "name": "service_type",
            "in": "query",
            "required": false,
            "description": "可选；只返回一种服务。服务器上线初版可忽略该参数并返回完整能力集。",
            "schema": {
              "type": "string",
              "enum": [
                "mobile_rescue",
                "emergency_power"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "服务能力与人工确认后的下单入口",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilitiesResponse"
                },
                "examples": {
                  "allServices": {
                    "value": {
                      "schema_version": "1.0",
                      "status": "read_only",
                      "updated_at": "2026-09-01T00:00:00+08:00",
                      "provider": {
                        "brand": "卜电",
                        "website": "https://www.evjy.net"
                      },
                      "transaction_boundary": {
                        "creates_order": false,
                        "dispatches_provider": false,
                        "collects_payment": false,
                        "collects_personal_information": false,
                        "human_confirmation_required_before_order": true,
                        "instruction": "本接口只返回业务能力与下单入口；点击入口后由用户在微信小程序内补充信息并确认。"
                      },
                      "services": [
                        {
                          "service_type": "mobile_rescue",
                          "name": "移动充电救援",
                          "aliases": [
                            "救援充电",
                            "上门充电",
                            "移动补电",
                            "新能源车没电救援",
                            "重卡救援充电"
                          ],
                          "supported_scenarios": [
                            "新能源乘用车途中没电",
                            "纯电轻卡、重卡或货车途中没电",
                            "停车场、园区或高速附近需要移动补电"
                          ],
                          "minimum_inputs_for_handoff": [
                            "服务位置",
                            "车辆类型",
                            "车辆剩余电量或故障描述"
                          ],
                          "optional_inputs": [
                            "车型",
                            "充电接口",
                            "期望补电量",
                            "联系人和联系电话"
                          ],
                          "action": {
                            "label": "进入移动充电救援下单页",
                            "url": "https://www.evjy.net/__growth/v1/cta/ai/baidu-ai/mobile-rescue",
                            "channel": "baidu_ai"
                          }
                        },
                        {
                          "service_type": "emergency_power",
                          "name": "应急供电/保电",
                          "aliases": [
                            "临时供电",
                            "活动保电",
                            "发电机租赁",
                            "应急电源",
                            "临时用电保障"
                          ],
                          "supported_scenarios": [
                            "活动、展会、演出或直播临时保电",
                            "工地、商场、园区或门店停电应急供电",
                            "需要发电机租赁或移动储能供电"
                          ],
                          "minimum_inputs_for_handoff": [
                            "用电地点",
                            "预计功率",
                            "使用时间"
                          ],
                          "optional_inputs": [
                            "电压",
                            "设备清单",
                            "是否需要静音",
                            "是否需要值守",
                            "联系人和联系电话"
                          ],
                          "action": {
                            "label": "进入应急供电/保电下单页",
                            "url": "https://www.evjy.net/__growth/v1/cta/ai/baidu-ai/emergency-power",
                            "channel": "baidu_ai"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "只允许 GET 或 HEAD",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "method_not_allowed"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CapabilitiesResponse": {
        "type": "object",
        "required": [
          "schema_version",
          "status",
          "updated_at",
          "provider",
          "transaction_boundary",
          "services"
        ],
        "properties": {
          "schema_version": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "read_only"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "provider": {
            "type": "object"
          },
          "transaction_boundary": {
            "type": "object"
          },
          "services": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "service_type",
                "name",
                "aliases",
                "supported_scenarios",
                "minimum_inputs_for_handoff",
                "optional_inputs",
                "action"
              ],
              "properties": {
                "service_type": {
                  "type": "string",
                  "enum": [
                    "mobile_rescue",
                    "emergency_power"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "aliases": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "supported_scenarios": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "minimum_inputs_for_handoff": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "optional_inputs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "action": {
                  "type": "object",
                  "required": [
                    "label",
                    "url",
                    "channel"
                  ],
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "channel": {
                      "type": "string",
                      "const": "baidu_ai"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
