"""
FastAPI routes for Document Compliance — required documents per business model.

Endpoints:
  POST /v1/document-compliance/required  — Determine required documents
"""

from typing import Optional

from fastapi import APIRouter
from pydantic import BaseModel

from services.document_scope_resolver import resolve_required_documents

router = APIRouter(prefix="/v1/document-compliance", tags=["document-compliance"])


class DocumentComplianceRequest(BaseModel):
    flags: dict[str, bool]
    jurisdiction: str = "DE"


@router.post("/required")
async def get_required_documents(req: DocumentComplianceRequest):
    """Determine which legal documents are required based on company flags.

    Flags example:
        has_website, has_ecommerce, has_saas, sells_physical_products,
        distance_selling, uses_tracking, uses_ai, b2b_only, etc.

    Returns required + recommended documents with legal basis and assessment.
    """
    return resolve_required_documents(
        flags=req.flags,
        jurisdiction=req.jurisdiction,
    )
