{
  "openapi": "3.0.3",
  "info": {
    "title": "OpenAPI 接口 - 购买/占用无状态会员",
    "version": "1.1.0",
    "description": "OpenAPI 接口相关接口文档"
  },
  "paths": {
    "/openapi/stateless-members/purchase": {
      "post": {
        "summary": "购买/占用无状态会员",
        "description": "将指定无状态会员标记为已售出（saleStatus=1），实现一卡一卖，防止同一卡密被二次购买。不校验、不记录激活状态；已售出卡密在有效期内仍可通过 activate/check 等接口无限次激活。",
        "parameters": [
          {
            "name": "X-Site",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "站点标识"
          },
          {
            "name": "X-System-Code",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "系统编码"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "string｜可选，无状态会员 _id 或数字 id"
                  },
                  "code": {
                    "type": "string",
                    "description": "string｜可选，无状态会员编码"
                  },
                  "orderNo": {
                    "type": "string",
                    "description": "string｜可选，关联订单号，写入 soldOrderNo"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "example": {
                  "success": {
                    "code": "0000",
                    "message": "购买成功",
                    "data": {
                      "id": "xxx",
                      "code": "SM0001",
                      "name": "无状态会员",
                      "saleStatus": 1,
                      "soldAt": "2025-01-15T10:00:00.000Z",
                      "soldOrderNo": "ORD-20250115-0010"
                    }
                  },
                  "failureNotFound": {
                    "code": "1510",
                    "message": "无状态会员不存在",
                    "data": null
                  },
                  "failureDisabled": {
                    "code": "1511",
                    "message": "无状态会员未启用，不可购买",
                    "data": null
                  },
                  "failureSold": {
                    "code": "1512",
                    "message": "该无状态会员已售出，不可重复购买",
                    "data": null
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}