{
  "openapi": "3.0.3",
  "info": {
    "title": "活动管理演示 API",
    "version": "1.0.0",
    "description": "用于验证 OpenAPI 工具转换、REST 调用和多轮 Agent 编排的本地服务。"
  },
  "servers": [
    {
      "url": "http://127.0.0.1:8765"
    }
  ],
  "paths": {
    "/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "列出全部活动",
        "description": "返回当前活动列表。",
        "x-agent-enabled": true,
        "responses": {
          "200": {
            "description": "活动列表"
          }
        }
      },
      "post": {
        "operationId": "createEvent",
        "summary": "创建活动",
        "description": "创建一个新活动并返回系统生成的活动编号。",
        "x-agent-enabled": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "创建成功"
          }
        }
      }
    },
    "/events/{event_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EventId"
        }
      ],
      "get": {
        "operationId": "getEvent",
        "summary": "查询单个活动",
        "description": "根据活动编号返回活动详情。",
        "x-agent-enabled": true,
        "responses": {
          "200": {
            "description": "活动详情"
          },
          "404": {
            "description": "活动不存在"
          }
        }
      },
      "delete": {
        "operationId": "deleteEvent",
        "summary": "删除活动",
        "description": "根据活动编号删除活动。该操作具有副作用。",
        "x-agent-enabled": true,
        "responses": {
          "200": {
            "description": "删除成功"
          },
          "404": {
            "description": "活动不存在"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "EventId": {
        "name": "event_id",
        "in": "path",
        "required": true,
        "description": "活动编号",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]{1,12}$"
        }
      }
    },
    "schemas": {
      "EventInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "活动名称"
          },
          "date": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
            "description": "活动日期，格式为 YYYY-MM-DD"
          },
          "location": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "活动地点"
          }
        },
        "required": [
          "name",
          "date",
          "location"
        ],
        "additionalProperties": false
      }
    }
  }
}


