"""Роутер публичных настроек клиента — доступен без аутентификации."""

from typing import Annotated

from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession

from core.db import get_session
from schemas.public import PublicSettingsOut
from services.instance_settings import InstanceSettingsService

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


@router.get("/settings", response_model=PublicSettingsOut)
async def public_settings(
    session: Annotated[AsyncSession, Depends(get_session)],
) -> PublicSettingsOut:
    """Флаги инстанса, нужные публичным страницам логина/входа гостя до аутентификации."""
    cfg = await InstanceSettingsService(session).get()
    return PublicSettingsOut(
        device_check_enabled=cfg.device_check_enabled,
        virtual_background_enabled=cfg.virtual_background_enabled,
    )
