{
  "openapi": "3.0.3",
  "info": {
    "title": "Vion Platform IoT Web API",
    "version": "0.1.0",
    "description": "**中文**\n\nVion 7.0 平台 IoT 模块的 Web 页面接口契约，涵盖本地设备上报同步清单与 ROI 绑定。\n\n**English**\n\nVion 7.0 platform IoT Web API contract covering locally synchronized device-reported inventory and ROI bindings."
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "iot",
      "description": "**中文**\n\n本地设备上报同步清单与 ROI 绑定\n\n**English**\n\nLocally synchronized device-reported inventory and ROI bindings"
    }
  ],
  "x-doc-groups": [
    {
      "id": "roi-bindings",
      "title": "观测区域绑定 / ROI Bindings",
      "operations": [
        "listRoiBindings",
        "saveRoiBindings"
      ]
    },
    {
      "id": "aiot-rois",
      "title": "设备上报的观测区域 / Device-Reported ROIs",
      "operations": [
        "listAiotRois"
      ]
    }
  ],
  "paths": {
    "/api/platform/iot/sites/{siteId}/roi-bindings": {
      "get": {
        "operationId": "listRoiBindings",
        "tags": [
          "iot"
        ],
        "summary": "查询场所的当前与历史 ROI 绑定 / List current and historical ROI bindings for a site",
        "parameters": [
          {
            "name": "siteId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UidString"
            },
            "description": "**中文**\n\n查询或配置的目标场所 ID。\n\n**English**\n\nID of the target site to query or configure."
          }
        ],
        "responses": {
          "200": {
            "description": "**中文**\n\nROI 绑定列表\n\n**English**\n\nList of ROI bindings",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoiBindingListEnvelope"
                },
                "examples": {
                  "success": {
                    "value": {
                      "code": 0,
                      "data": {
                        "items": [
                          {
                            "bindingId": "8001",
                            "tenantId": "01a2319e-215e-74f1-b5e0-b9650e2a3f98",
                            "siteId": "01a2319e-2165-70ab-b75b-6059601deb62",
                            "roiCode": "R-1001",
                            "targetType": "SPACE_SLOT",
                            "spaceId": "01a2319e-2167-7240-bc32-25e7efb4b1e6",
                            "slotId": "01a2319e-2167-7240-bc32-25e9b2c35258",
                            "directionMode": 1,
                            "metricRole": "DWELL_TOUCH",
                            "validFrom": "2026-11-01T00:00:00Z",
                            "validTo": null,
                            "channelCode": "CH-001"
                          }
                        ]
                      },
                      "message": "ok",
                      "requestId": "550e8400-e29b-41d4-a716-446655440309"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        },
        "description": "**中文**\n\n按场所读取观测区域与统计目标之间的绑定，包含当前和历史记录。\n\n**English**\n\nRead bindings between regions of interest and statistical targets for the site, including current and historical records."
      }
    },
    "/api/platform/iot/sites/{siteId}/roi-bindings/update": {
      "post": {
        "operationId": "saveRoiBindings",
        "tags": [
          "iot"
        ],
        "summary": "保存场所的 ROI 绑定配置 / Save ROI binding configuration for a site",
        "parameters": [
          {
            "name": "siteId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UidString"
            },
            "description": "**中文**\n\n查询或配置的目标场所 ID。\n\n**English**\n\nID of the target site to query or configure."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveRoiBindingsRequest"
              },
              "examples": {
                "request": {
                  "value": {
                    "bindings": [
                      {
                        "roiCode": "R-1001",
                        "targetType": "SPACE_SLOT",
                        "spaceId": "01a2319e-2167-7240-bc32-25e7efb4b1e6",
                        "slotId": "01a2319e-2167-7240-bc32-25e9b2c35258",
                        "directionMode": 1,
                        "metricRole": "DWELL_TOUCH",
                        "effectiveAt": "2026-11-17T00:00:00Z",
                        "channelCode": "CH-001"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "**中文**\n\n保存后的 ROI 绑定列表\n\n**English**\n\nROI binding list after saving",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoiBindingListEnvelope"
                },
                "examples": {
                  "success": {
                    "value": {
                      "code": 0,
                      "data": {
                        "items": [
                          {
                            "bindingId": "8002",
                            "tenantId": "01a2319e-215e-74f1-b5e0-b9650e2a3f98",
                            "siteId": "01a2319e-2165-70ab-b75b-6059601deb62",
                            "roiCode": "R-1001",
                            "targetType": "SPACE_SLOT",
                            "spaceId": "01a2319e-2167-7240-bc32-25e7efb4b1e6",
                            "slotId": "01a2319e-2167-7240-bc32-25e9b2c35258",
                            "directionMode": 1,
                            "metricRole": "DWELL_TOUCH",
                            "validFrom": "2026-11-17T00:00:00Z",
                            "validTo": null,
                            "channelCode": "CH-001"
                          }
                        ]
                      },
                      "message": "ok",
                      "requestId": "550e8400-e29b-41d4-a716-446655440310"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        },
        "description": "**中文**\n\n契约接受待保存的 ROI 绑定集合，每项指定观测区域、目标层级、统计用途、方向和生效时刻。\n\n**English**\n\nThe contract accepts a collection of ROI bindings to save. Each entry specifies the ROI, target level, statistical role, direction, and effective instant."
      }
    },
    "/api/platform/iot/sites/{siteId}/aiot-rois": {
      "get": {
        "operationId": "listAiotRois",
        "tags": [
          "iot"
        ],
        "summary": "查询设备上报同步到本地的 ROI 清单 / List ROI records reported by devices and synchronized locally",
        "description": "**中文**\n\n通过通道编码 channelCode 和 roiCode 标识画面中的观测区域。\n\n**English**\n\nIdentify a region of interest in a video channel using both channelCode and roiCode.",
        "parameters": [
          {
            "name": "siteId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UidString"
            },
            "description": "**中文**\n\n查询或配置的目标场所 ID。\n\n**English**\n\nID of the target site to query or configure."
          }
        ],
        "responses": {
          "200": {
            "description": "**中文**\n\n已同步到平台的本地 ROI 清单\n\n**English**\n\nLocal ROI inventory synchronized to the platform",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiotRoiListEnvelope"
                },
                "examples": {
                  "success": {
                    "value": {
                      "code": 0,
                      "data": {
                        "items": [
                          {
                            "roiCode": "R-1001",
                            "roiType": "TOUCH",
                            "deviceSerialnum": "CAM-001",
                            "name": "货架 A 面触达规则",
                            "syncStatus": "SYNCED",
                            "channelCode": "CH-001"
                          }
                        ]
                      },
                      "message": "ok",
                      "requestId": "550e8400-e29b-41d4-a716-446655440311"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "**中文**\n\nKeycloak 签发的 OpenID Connect 访问令牌（Bearer JWT）。\n\n**English**\n\nOpenID Connect access token issued by Keycloak (Bearer JWT)."
      }
    },
    "schemas": {
      "RoiBinding": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "bindingId",
          "tenantId",
          "siteId",
          "roiCode",
          "targetType",
          "spaceId",
          "directionMode",
          "metricRole",
          "validFrom",
          "channelCode"
        ],
        "properties": {
          "bindingId": {
            "$ref": "#/components/schemas/IdString"
          },
          "tenantId": {
            "$ref": "#/components/schemas/UidString"
          },
          "siteId": {
            "$ref": "#/components/schemas/UidString"
          },
          "roiCode": {
            "type": "string",
            "description": "**中文**\n\n视频画面中的 ROI 编码，与 channelCode 共同定位观测区域。\n\n**English**\n\nROI code within a video channel, identifying the region of interest together with channelCode."
          },
          "targetType": {
            "type": "string",
            "enum": [
              "SITE",
              "SPACE",
              "SPACE_SLOT"
            ],
            "description": "**中文**\n\n绑定目标层级：SITE 整场、SPACE 空间、SPACE_SLOT 空间槽位。\n\n**English**\n\nBinding target level: SITE for the whole site, SPACE for a space, and SPACE_SLOT for a space slot."
          },
          "spaceId": {
            "$ref": "#/components/schemas/UidString"
          },
          "slotId": {
            "$ref": "#/components/schemas/NullableUidString",
            "description": "**中文**\n\nSPACE_SLOT 绑定的目标槽位 ID，其他目标层级不使用槽位 ID。\n\n**English**\n\nTarget slot ID for SPACE_SLOT bindings. Other target levels do not use a slot ID."
          },
          "directionMode": {
            "type": "integer",
            "enum": [
              1,
              -1
            ],
            "description": "**中文**\n\n进出方向计数方式，1 沿用设备方向，-1 对调进入与离开。\n\n**English**\n\nDirection counting mode. 1 retains the device direction and -1 swaps entry and exit."
          },
          "metricRole": {
            "type": "string",
            "enum": [
              "ENTRY_EXIT",
              "PASS_BY",
              "DWELL_TOUCH",
              "QUEUE"
            ],
            "description": "**中文**\n\n统计用途：ENTRY_EXIT 进出客流，PASS_BY 场所或区域外围路过客流，DWELL_TOUCH 驻留、热力、关注与触达，QUEUE 排队与收银服务。\n\n**English**\n\nStatistical role: ENTRY_EXIT for entry and exit traffic, PASS_BY for traffic passing a site or area perimeter, DWELL_TOUCH for dwell, heatmaps, attention, and touch, and QUEUE for queuing and checkout service."
          },
          "validFrom": {
            "type": "string",
            "format": "date-time",
            "description": "**中文**\n\n绑定的生效起始时刻，包含该时刻。\n\n**English**\n\nInclusive start instant of the binding's validity."
          },
          "validTo": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "**中文**\n\n绑定的失效时刻，不包含该时刻。null 表示开放的有效区间。\n\n**English**\n\nExclusive end instant of the binding's validity. null represents an open-ended interval."
          },
          "channelCode": {
            "type": "string",
            "minLength": 1,
            "description": "**中文**\n\n设备上报的视频画面通道编码。\n\n**English**\n\nDevice-reported video channel code."
          }
        },
        "description": "**中文**\n\nSITE 使用 spaceId 为字符串 \"0\" 并省略 slotId。SPACE 使用所属空间 ID。SPACE_SLOT 使用所属空间 ID 和槽位 ID。\n\n**English**\n\nFor SITE, set spaceId to the string \"0\" and omit slotId. For SPACE, use the owning space ID. For SPACE_SLOT, use the owning space ID and slot ID."
      },
      "RoiBindingInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "roiCode",
          "targetType",
          "spaceId",
          "directionMode",
          "metricRole",
          "effectiveAt",
          "channelCode"
        ],
        "properties": {
          "roiCode": {
            "type": "string",
            "minLength": 1,
            "description": "**中文**\n\n视频画面中的 ROI 编码，与 channelCode 共同定位观测区域。\n\n**English**\n\nROI code within a video channel, identifying the region of interest together with channelCode."
          },
          "targetType": {
            "type": "string",
            "enum": [
              "SITE",
              "SPACE",
              "SPACE_SLOT"
            ],
            "description": "**中文**\n\n绑定目标层级：SITE 整场、SPACE 空间、SPACE_SLOT 空间槽位。\n\n**English**\n\nBinding target level: SITE for the whole site, SPACE for a space, and SPACE_SLOT for a space slot."
          },
          "spaceId": {
            "$ref": "#/components/schemas/UidString"
          },
          "slotId": {
            "$ref": "#/components/schemas/NullableUidString",
            "description": "**中文**\n\nSPACE_SLOT 绑定的目标槽位 ID，其他目标层级不使用槽位 ID。\n\n**English**\n\nTarget slot ID for SPACE_SLOT bindings. Other target levels do not use a slot ID."
          },
          "directionMode": {
            "type": "integer",
            "enum": [
              1,
              -1
            ],
            "description": "**中文**\n\n进出方向计数方式，1 沿用设备方向，-1 对调进入与离开。\n\n**English**\n\nDirection counting mode. 1 retains the device direction and -1 swaps entry and exit."
          },
          "metricRole": {
            "type": "string",
            "enum": [
              "ENTRY_EXIT",
              "PASS_BY",
              "DWELL_TOUCH",
              "QUEUE"
            ],
            "description": "**中文**\n\n统计用途：ENTRY_EXIT 进出客流，PASS_BY 场所或区域外围路过客流，DWELL_TOUCH 驻留、热力、关注与触达，QUEUE 排队与收银服务。\n\n**English**\n\nStatistical role: ENTRY_EXIT for entry and exit traffic, PASS_BY for traffic passing a site or area perimeter, DWELL_TOUCH for dwell, heatmaps, attention, and touch, and QUEUE for queuing and checkout service."
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time",
            "description": "**中文**\n\n该绑定版本开始生效的时刻。\n\n**English**\n\nInstant when this binding version takes effect."
          },
          "channelCode": {
            "type": "string",
            "minLength": 1,
            "description": "**中文**\n\n设备上报的视频画面通道编码。\n\n**English**\n\nDevice-reported video channel code."
          }
        },
        "description": "**中文**\n\nSITE 使用 spaceId 为字符串 \"0\" 并省略 slotId。SPACE 使用所属空间 ID。SPACE_SLOT 使用所属空间 ID 和槽位 ID。\n\n**English**\n\nFor SITE, set spaceId to the string \"0\" and omit slotId. For SPACE, use the owning space ID. For SPACE_SLOT, use the owning space ID and slot ID."
      },
      "SaveRoiBindingsRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "bindings"
        ],
        "properties": {
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoiBindingInput"
            },
            "description": "**中文**\n\n待保存的 ROI 绑定配置集合。\n\n**English**\n\nCollection of ROI binding configurations to save."
          }
        }
      },
      "RoiBindingListData": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoiBinding"
            },
            "description": "**中文**\n\nROI 绑定记录列表。\n\n**English**\n\nList of ROI binding records."
          }
        }
      },
      "RoiBindingListEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "data",
          "message",
          "requestId"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "enum": [
              0
            ],
            "description": "**中文**\n\n业务响应状态码，成功固定为 0。\n\n**English**\n\nBusiness response status code, always 0 on success."
          },
          "data": {
            "$ref": "#/components/schemas/RoiBindingListData"
          },
          "message": {
            "type": "string",
            "description": "**中文**\n\n面向调用方与排查的可读提示信息。\n\n**English**\n\nHuman-readable message for callers and troubleshooting."
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "**中文**\n\n本次请求的唯一追踪标识。\n\n**English**\n\nUnique trace identifier for this request."
          }
        }
      },
      "AiotRoi": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "roiCode",
          "roiType",
          "deviceSerialnum",
          "channelCode",
          "name",
          "syncStatus"
        ],
        "properties": {
          "roiCode": {
            "type": "string",
            "description": "**中文**\n\n视频画面中的 ROI 编码，与 channelCode 共同定位观测区域。\n\n**English**\n\nROI code within a video channel, identifying the region of interest together with channelCode."
          },
          "roiType": {
            "type": "string",
            "description": "**中文**\n\n观测区域类型编码。\n\n**English**\n\nType code of the region of interest."
          },
          "deviceSerialnum": {
            "type": "string",
            "description": "**中文**\n\n上报观测区域的设备序列号。\n\n**English**\n\nSerial number of the device reporting the ROI."
          },
          "channelCode": {
            "type": "string",
            "minLength": 1,
            "description": "**中文**\n\n设备上报的视频画面通道编码。\n\n**English**\n\nDevice-reported video channel code."
          },
          "name": {
            "type": "string",
            "description": "**中文**\n\n设备上报同步的观测区域名称。\n\n**English**\n\nName of the ROI synchronized from the device report."
          },
          "syncStatus": {
            "type": "string",
            "description": "**中文**\n\n设备上报的 ROI 同步至平台本地清单的状态。\n\n**English**\n\nStatus of synchronization of the device-reported ROI to the platform's local inventory."
          }
        }
      },
      "AiotRoiListData": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiotRoi"
            },
            "description": "**中文**\n\n已同步到本地的 ROI 清单。\n\n**English**\n\nList of locally synchronized ROIs."
          }
        }
      },
      "AiotRoiListEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "data",
          "message",
          "requestId"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "enum": [
              0
            ],
            "description": "**中文**\n\n业务响应状态码，成功固定为 0。\n\n**English**\n\nBusiness response status code, always 0 on success."
          },
          "data": {
            "$ref": "#/components/schemas/AiotRoiListData"
          },
          "message": {
            "type": "string",
            "description": "**中文**\n\n面向调用方与排查的可读提示信息。\n\n**English**\n\nHuman-readable message for callers and troubleshooting."
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "**中文**\n\n本次请求的唯一追踪标识。\n\n**English**\n\nUnique trace identifier for this request."
          }
        }
      },
      "UidString": {
        "type": "string",
        "minLength": 1,
        "maxLength": 36,
        "description": "**中文**\n\n双键实体的不可变外部标识 uid。新建实体使用 UUIDv7，6.0 迁移沿用非空、合法且唯一的源 unid。\nAPI 字段名及 X-Tenant-Id 请求头保持现有名称。纯数字值不得回退解析为内部自增 id。\n仅在字段明确约定时允许字符串 \"0\" 作为预置或无关联哨兵。\n\n**English**\n\nImmutable external UID of a dual-key entity. New entities use UUIDv7. Migration from 6.0 retains nonempty, valid and unique source UNIDs.\nAPI field names and the X-Tenant-Id request header retain their existing names. Purely numeric values must not fall back to parsing as internal auto-increment IDs.\nThe string \"0\" is permitted as a built-in or unassociated sentinel only where the field explicitly defines it."
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "data",
          "message",
          "requestId"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "minimum": 1,
            "description": "**中文**\n\n稳定非零业务错误码，与 HTTP 错误状态共同表达失败。\n\n**English**\n\nStable nonzero business error code. It represents failure together with the HTTP error status."
          },
          "data": {
            "type": "object",
            "nullable": true,
            "maxProperties": 0,
            "description": "**中文**\n\n失败响应固定为 `null`。\n\n**English**\n\nAlways null in failure responses."
          },
          "message": {
            "type": "string",
            "description": "**中文**\n\n面向调用方与排查的英文错误描述，不包含内部 SQL、凭据或隐藏对象详情。\n\n**English**\n\nEnglish error description for callers and troubleshooting, excluding internal SQL, credentials, and details of hidden objects."
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "**中文**\n\n与响应头 `X-Request-Id` 相同，用于日志定位。\n\n**English**\n\nMatches X-Request-Id in the response header and is used to locate log entries."
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "description": "**中文**\n\n`40002` 必须返回 `UNSUPPORTED_*` 或 `TARGET_*` 错误子码。\n`40301` 可以附带 `SCOPE_NOT_AUTHORIZED`。\n`40901` 可附带租户启用失败或组织关联冲突的错误子码。\n其余错误可省略此字段或返回 `null`。\n\n**English**\n\n40002 must return a UNSUPPORTED_* or TARGET_* error subcode.\n40301 may include SCOPE_NOT_AUTHORIZED.\n40901 may include an error subcode for tenant enablement failure or organization association conflict.\nOther errors may omit this field or return null.",
            "enum": [
              "UNSUPPORTED_ROLLUP_ORG",
              "UNSUPPORTED_ROLLUP_SPACE",
              "UNSUPPORTED_ROLLUP_TIME",
              "TARGET_DIMENSION_MISSING",
              "TARGET_SCOPE_CONFLICT",
              "UNSUPPORTED_SPACE_TYPE",
              "UNSUPPORTED_SLOT_TYPE",
              "UNSUPPORTED_GRANULARITY",
              "UNSUPPORTED_DIMENSION",
              "UNSUPPORTED_FILTER_OPERATOR",
              "SCOPE_NOT_AUTHORIZED",
              "INVALID_TOKEN",
              "INVALID_REQUEST",
              "ORGANIZATION_REQUIRED",
              "TENANT_ACCESS_DENIED",
              "ACCESS_DENIED",
              "ADMIN_GROUP_CONFLICT",
              "IDENTITY_UNAVAILABLE",
              "IDENTITY_REQUEST_FAILED",
              "MEMBERSHIP_UPDATE_INCOMPLETE",
              "TENANT_EXPIRED",
              "TENANT_NOT_PROVISIONED",
              "ORGANIZATION_CONFLICT",
              null,
              "IDENTITY_CREATE_UNCONFIRMED",
              "USER_CREATE_INCOMPLETE",
              "USER_CREATE_FAILED",
              "TENANT_PROVISIONING_INCOMPLETE",
              "TENANT_PROVISIONING_UNCONFIRMED",
              "ORGANIZATION_DISABLED"
            ]
          },
          "params": {
            "type": "object",
            "description": "**中文**\n\n由错误标识对应的契约定义的文案插值参数，仅供文案插值，不得包含敏感数据。\n\n**English**\n\nMessage interpolation parameters as defined by the contract for the error identifier, used only for interpolation. They must not contain sensitive data.",
            "additionalProperties": {
              "$ref": "#/components/schemas/ErrorParamValue"
            }
          }
        }
      },
      "ErrorParamValue": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          }
        ],
        "description": "**中文**\n\n错误文案插值参数的值，支持字符串或数值。\n\n**English**\n\nError message interpolation parameter value, either a string or a number."
      },
      "IdString": {
        "type": "string",
        "minLength": 1,
        "description": "**中文**\n\n非双键实体的既有标识（如角色、用户、行政区划、绑定关系），以字符串传递。\n\n**English**\n\nExisting identifiers for entities without dual keys (such as roles, users, administrative regions and bindings), transmitted as strings."
      },
      "NullableUidString": {
        "type": "string",
        "nullable": true,
        "description": "**中文**\n\n可以为 null 的 UidString，用于可空的双键实体关联。\n\n**English**\n\nA UidString that may be null, used for nullable relationships between dual-key entities.",
        "anyOf": [
          {
            "$ref": "#/components/schemas/UidString"
          },
          {
            "type": "string",
            "nullable": true,
            "enum": [
              null
            ]
          }
        ]
      }
    },
    "headers": {
      "X-Request-Id": {
        "description": "**中文**\n\n本次请求唯一追踪标识，与响应体 `requestId` 一致。\n\n**English**\n\nUnique trace identifier for this request, matching requestId in the response body.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "**中文**\n\n凭证缺失、无效或已过期（code 40101）。\n\n**English**\n\nCredentials missing, invalid, or expired (code 40101).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "code": 40101,
              "data": null,
              "message": "Authentication required or token expired.",
              "requestId": "550e8400-e29b-41d4-a716-446655440001"
            }
          }
        }
      },
      "Forbidden": {
        "description": "**中文**\n\n无权访问目标资源（code 40301）。\n\n**English**\n\nUnauthorized access to the target resource (code 40301).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "code": 40301,
              "data": null,
              "message": "Access denied for the requested scope or resource.",
              "requestId": "550e8400-e29b-41d4-a716-446655440002"
            }
          }
        }
      },
      "BadRequest": {
        "description": "**中文**\n\n请求参数或业务组合无效（code 40001 / 40002）。\n\n**English**\n\nInvalid request parameters or business combination (code 40001 / 40002).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "code": 40001,
              "data": null,
              "message": "Invalid request parameter.",
              "requestId": "550e8400-e29b-41d4-a716-446655440000"
            }
          }
        }
      },
      "Conflict": {
        "description": "**中文**\n\n资源唯一性或生效区间冲突（code 40901）。\n\n**English**\n\nResource uniqueness or effective interval conflict (code 40901).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "code": 40901,
              "data": null,
              "message": "Resource conflict or overlapping effective period.",
              "requestId": "550e8400-e29b-41d4-a716-446655440004"
            }
          }
        }
      },
      "Unavailable": {
        "description": "**中文**\n\n依赖服务不可用（code 50301）。\n\n**English**\n\nDependent service unavailable (code 50301).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "code": 50301,
              "data": null,
              "message": "Dependent service unavailable.",
              "requestId": "550e8400-e29b-41d4-a716-446655440009"
            }
          }
        }
      }
    }
  }
}
