"""
Public directions response schema for INDL-43.

Strict allowlist — only the fields required to render the mini-map and the PDF are
exposed. Internal record/plot fields (internal_notes, price, reserved_by,
cause_of_death, contract_id, tenant_id, deleted_at) must never appear here
(API3 / SEC-04 / SAC-03).
"""
from __future__ import annotations

from typing import Optional

from pydantic import BaseModel, ConfigDict


class DirectionsResponse(BaseModel):
    """Location + computed walking directions for a single published memorial's plot."""

    model_config = ConfigDict(from_attributes=False, extra="forbid")

    # Location identity (server-controlled strings, never visitor input).
    section_code: Optional[str] = None
    section_name: Optional[str] = None
    plot_ref: str

    # Coordinates — validated numeric, within geographic bounds, or None (no-GPS state).
    latitude: Optional[float] = None
    longitude: Optional[float] = None
    has_gps: bool = False

    # Computed straight-line approximation — omitted (None) when entrance coords
    # are not configured (INDL-22 not yet shipped) per AC-03 / SAC-10.
    walking_minutes: Optional[int] = None
    distance_m: Optional[int] = None

    # Cemetery context used by the PDF header and the "full map" link.
    cemetery_name: Optional[str] = None
    cemetery_address: Optional[str] = None
    visiting_hours: Optional[str] = None
