{
  "openapi": "3.1.0",
  "info": {
    "title": "VUP Flow 入场 API",
    "version": "1.0.0",
    "description": "公开读取。数据源未接入时 /v1/entries 返回 503。事件窗口为最近 3600 秒。"
  },
  "servers": [
    {
      "url": "https://api.vupflow.cloud"
    }
  ],
  "paths": {
    "/healthz": {
      "get": {
        "responses": {
          "200": {
            "description": "服务与数据接入状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "feed_connected": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "service",
                    "feed_connected",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/entries": {
      "get": {
        "parameters": [
          {
            "name": "visitor_uid",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,19}$"
            }
          },
          {
            "name": "room_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,19}$"
            }
          },
          {
            "name": "host_uid",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,19}$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "数据源已接入时，按接收顺序返回当前一小时内的普通入场",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "event_id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "room.enter"
                            ]
                          },
                          "visitor_uid": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]{0,19}$"
                          },
                          "room_id": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]{0,19}$"
                          },
                          "host_uid": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]{0,19}$"
                          },
                          "occurred_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "event_id",
                          "type",
                          "visitor_uid",
                          "room_id",
                          "host_uid",
                          "occurred_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": "string"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "events",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "参数格式错误"
          },
          "503": {
            "description": "真实数据尚未接入",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "feed_not_connected"
                      ]
                    },
                    "feed_connected": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    }
                  },
                  "required": [
                    "error",
                    "feed_connected"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    }
  }
}
