from __future__ import annotations

from fastapi import APIRouter, Depends

from backend.app.api.schemas import SettingsResponse, SettingsUpdateRequest
from backend.app.dependencies import get_settings_service
from backend.app.services.settings_service import SettingsService

router = APIRouter(prefix="/settings")


@router.get("", response_model=SettingsResponse)
async def get_settings(
    service: SettingsService = Depends(get_settings_service),
) -> SettingsResponse:
    return service.get_settings()


@router.post("", response_model=SettingsResponse)
async def update_settings(
    request: SettingsUpdateRequest,
    service: SettingsService = Depends(get_settings_service),
) -> SettingsResponse:
    return service.update_settings(request)
