from fastapi import APIRouter

from app.api.v1.endpoints import (
    auth, users, apps, utils, simple_auth, oidc,
    open_api, logs, system_logs, backup, login_logs,
    user_import, system, system_config, sms_auth,
    messages, messages_upload, ws, client_distributions, identity_qr,
    organizations,
    admin_api_keys, admin_api_users, admin_api_orgs,
)

api_router = APIRouter()
api_router.include_router(auth.router, prefix="/auth", tags=["认证 (Auth)"])
api_router.include_router(users.router, prefix="/users", tags=["用户管理 (Users)"])
api_router.include_router(
    organizations.router, prefix="/organizations", tags=["组织 (Organizations)"]
)
api_router.include_router(user_import.router, prefix="/users", tags=["用户导入 (User Import)"])
api_router.include_router(apps.router, prefix="/apps", tags=["应用管理 (Applications)"])
api_router.include_router(client_distributions.router, prefix="/client-distributions", tags=["客户端分发 (Client Distribution)"])
api_router.include_router(logs.router, prefix="/logs", tags=["操作日志 (Logs)"])
api_router.include_router(login_logs.router, prefix="/login-logs", tags=["登录日志 (Login Logs)"])
api_router.include_router(system_logs.router, prefix="/system-logs", tags=["后台日志 (System Logs)"])
api_router.include_router(backup.router, prefix="/backups", tags=["数据备份 (Backup)"])
api_router.include_router(system.router, prefix="/system", tags=["系统管理 (System)"])
api_router.include_router(system_config.router, prefix="/system/config", tags=["系统配置 (System Config)"])
api_router.include_router(utils.router, prefix="/utils", tags=["工具 (Utils)"])
api_router.include_router(simple_auth.router, prefix="/simple", tags=["简易认证 (SimpleAuth)"])
api_router.include_router(sms_auth.router, prefix="/auth/sms", tags=["短信认证 (SMS Auth)"])
api_router.include_router(oidc.router, prefix="/oidc", tags=["OIDC (OpenID Connect)"])
api_router.include_router(open_api.router, prefix="/open", tags=["开放接口 (OpenAPI)"])
api_router.include_router(
    identity_qr.router, prefix="/identity-qr", tags=["身份二维码 (Identity QR)"]
)

# 消息通知模块
api_router.include_router(messages.router, prefix="/messages", tags=["消息通知 (Messages)"])
api_router.include_router(messages_upload.router, prefix="/messages", tags=["消息附件 (Upload)"])
api_router.include_router(ws.router, prefix="/ws", tags=["WebSocket (Realtime)"])

# 管理员级 API Key（永久凭证）后台 + 调用入口
api_router.include_router(admin_api_keys.router, prefix="/admin-api-keys", tags=["管理 API Key"])
api_router.include_router(admin_api_users.router, prefix="/admin-api/users", tags=["管理 API - 用户"])
api_router.include_router(admin_api_orgs.router, prefix="/admin-api/organizations", tags=["管理 API - 组织"])
