from fastapi import APIRouter, Depends
from pydantic import BaseModel
from sqlalchemy.orm import Session

from database import get_db
from routers.deps import require_settings_manager
from models.user import User

router = APIRouter()


class TestFoldersRequest(BaseModel):
    out_folder: str
    in_folder: str


@router.post("/test-folders")
def test_folders(
    body: TestFoldersRequest,
    db: Session = Depends(get_db),
    user: User = Depends(require_settings_manager),
):
    """Verify that both fiscal folders are accessible (read + write) from inside the container."""
    from services.fiscal_service import test_folders
    return test_folders(body.out_folder.strip(), body.in_folder.strip())
