"""Domain models for split-payload document intake (ADR-001)."""
from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, Field


class DocumentMetadata(BaseModel):
    """Plaintext routing metadata — backend routes on this only."""

    authority_id: str = Field(..., max_length=50, alias="authorityId")
    reference_number: str = Field(..., max_length=50, alias="referenceNumber")
    doc_type: str = Field(..., max_length=50, alias="docType")
    issued_at: datetime = Field(..., alias="issuedAt")

    model_config = {"populate_by_name": True}


class DocumentCreateRequest(BaseModel):
    metadata: DocumentMetadata
    encrypted_payload: str = Field(
        ...,
        description="Base64-encoded opaque blob; routing layer must not decode",
        alias="encryptedPayload",
    )

    model_config = {"populate_by_name": True}