"""同步相关路由（批量同步操作）"""

from fastapi import APIRouter, Depends
from sqlmodel import Session

from app.core.security import require_api_key
from app.database import get_session
from app.services import sync_service

router = APIRouter(prefix="/api/sync", tags=["sync"])


@router.post(
    "/ai-balances",
    summary="同步所有 AI 账号余额",
    dependencies=[Depends(require_api_key)],
)
def sync_ai_balances(session: Session = Depends(get_session)) -> dict:
    return sync_service.sync_all_ai_balances(session)
