"""Government ID verification stub."""

from app.schemas.common import JobStatus
from app.schemas.id_verification import IdVerificationRequest, IdVerificationResponse


class IdVerificationService:
    async def verify(self, payload: IdVerificationRequest) -> IdVerificationResponse:
        warnings: list[str] = []
        extracted_name = payload.expected_name
        match = 0.7
        if payload.expected_name and extracted_name:
            match = 0.88
        else:
            warnings.append("No expected_name provided — name match skipped")
            extracted_name = "EXTRACTED_NAME_STUB"
        verified = match >= 0.8
        return IdVerificationResponse(
            correlation_id=payload.correlation_id,
            status=JobStatus.SUCCEEDED,
            stub=True,
            message="ID verification local stub — wire OCR/KYC provider for production",
            verified=verified,
            extracted_name=extracted_name,
            extracted_id_number="****-STUB",
            document_type="government_id",
            match_score=match,
            warnings=warnings,
        )
