{
  "openapi": "3.1.0",
  "info": {
    "title": "Kaedeori WARDOGS Federation API",
    "version": "1.1.0",
    "description": "SteamID为字符串，时间为ISO UTC；当前名单与完整历史分开查询。isTest测试记录不进入公开接口及正式统计。"
  },
  "servers": [
    {
      "url": "https://api.kaedeori.com"
    }
  ],
  "paths": {
    "/all": {
      "get": {
        "summary": "当前有效all封禁",
        "parameters": [
          {
            "name": "steamId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{17}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "steamIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Ban"
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "occurrenceCount": {
                          "type": "integer"
                        },
                        "activeCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/behavior": {
      "get": {
        "summary": "当前有效behavior封禁",
        "parameters": [
          {
            "name": "steamId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{17}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "steamIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Ban"
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "occurrenceCount": {
                          "type": "integer"
                        },
                        "activeCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/cheater": {
      "get": {
        "summary": "当前有效cheater封禁",
        "parameters": [
          {
            "name": "steamId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{17}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "steamIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Ban"
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "occurrenceCount": {
                          "type": "integer"
                        },
                        "activeCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/history": {
      "get": {
        "summary": "精确SteamID完整历史",
        "parameters": [
          {
            "name": "steamId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{17}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "steamIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Ban"
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "occurrenceCount": {
                          "type": "integer"
                        },
                        "activeCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/images": {
      "post": {
        "summary": "上传证据 PNG/JPEG/WebP<=5MiB",
        "security": [
          {
            "ServerToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "filename",
                  "contentType",
                  "base64"
                ],
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "contentType": {
                    "enum": [
                      "image/png",
                      "image/jpeg",
                      "image/webp"
                    ]
                  },
                  "base64": {
                    "type": "string",
                    "contentEncoding": "base64"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "contentType": {
                          "type": "string"
                        },
                        "size": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/bans": {
      "post": {
        "summary": "创建独立封禁，requestId幂等",
        "security": [
          {
            "ServerToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "requestId",
                  "steamId",
                  "category",
                  "reason",
                  "images"
                ],
                "properties": {
                  "requestId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "steamId": {
                    "type": "string",
                    "pattern": "^[0-9]{17}$"
                  },
                  "category": {
                    "enum": [
                      "behavior",
                      "cheater"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 2000,
                    "minLength": 3
                  },
                  "images": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 5,
                    "items": {
                      "type": "string"
                    }
                  },
                  "startsAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "isTest": {
                    "type": "boolean",
                    "default": false,
                    "description": "接入测试标记，不可修改；true时始终从公开查询和正式统计排除。"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Ban"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "面板记录列表（含历史）",
        "security": [
          {
            "ServerToken": []
          }
        ],
        "parameters": [
          {
            "name": "steamId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mine",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serverId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "isTest",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "true仅测试，false仅正式，省略包含两类。"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Ban"
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "offset": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/bans/{id}/revoke": {
      "post": {
        "summary": "撤销本服务器记录并保留历史",
        "security": [
          {
            "ServerToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reason"
                ],
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 2000,
                    "minLength": 3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/Ban"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/stats": {
      "get": {
        "summary": "联盟与本服务器统计",
        "security": [
          {
            "ServerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误，error 为稳定的大写代码",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "服务状态及能力标记",
        "responses": {
          "200": {
            "description": "data.capabilities.testRecords及legacyTakeoverDedup为true时支持隔离测试与旧来源接管去重。"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ServerToken": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Ban": {
        "type": "object",
        "required": [
          "id",
          "steamId",
          "category",
          "reason",
          "images",
          "server",
          "startsAt",
          "endsAt",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "steamId": {
            "type": "string",
            "pattern": "^[0-9]{17}$"
          },
          "category": {
            "enum": [
              "behavior",
              "cheater"
            ]
          },
          "reason": {
            "type": "string"
          },
          "images": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "contentType": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                }
              }
            }
          },
          "server": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revokeReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "active",
              "revoked",
              "expired"
            ]
          },
          "startTimeSource": {
            "type": "string"
          },
          "isTest": {
            "type": "boolean",
            "description": "仅认证接口返回；测试记录不出现在公开接口。"
          },
          "requestId": {
            "type": "string",
            "description": "仅认证接口返回；来源记录的稳定幂等标识。"
          }
        }
      }
    }
  }
}
