"""Конфигурация AmneziaWG: чтение, атомарное применение, сухая валидация.""" from __future__ import annotations from typing import Any from fastapi import APIRouter, Depends from awg_api.deps import StateDep, require_token from awg_api.schemas import ConfigUpdateRequest router = APIRouter(prefix="/api/v1/config", tags=["config"], dependencies=[Depends(require_token)]) @router.get("") async def get_config(state: StateDep) -> dict[str, Any]: return state.get_config() @router.put("") async def put_config(payload: ConfigUpdateRequest, state: StateDep) -> dict[str, Any]: return state.apply_config(payload) @router.post("/validate") async def validate_config(payload: ConfigUpdateRequest, state: StateDep) -> dict[str, Any]: return state.validate_config(payload)