"""Protocol surface for the MAVLink I/O component (ARCH-05).

Phase 1: mirrors the concrete ``MAVLinkBridge`` public surface from
``core/mavlink.py`` (no ABC today). Adapters move here in Plan 07
(mavlink_io); private helpers ``_confidence_to_fix_type`` and
``_eskf_to_gps_input`` MUST stay re-exported from the old path.
"""
from __future__ import annotations

from typing import Callable, Optional, Protocol, runtime_checkable

from gps_denied.schemas import GPSPoint
from gps_denied.schemas.eskf import ESKFState, IMUMeasurement
from gps_denied.schemas.mavlink import GPSInputMessage, RelocalizationRequest


@runtime_checkable
class MAVLinkBridgeProtocol(Protocol):
    """Public surface of the MAVLink GPS_INPUT/IMU/telemetry bridge."""

    def set_imu_callback(
        self, cb: Callable[[IMUMeasurement], None]
    ) -> None: ...

    def set_reloc_callback(
        self, cb: Callable[[RelocalizationRequest], None]
    ) -> None: ...

    def update_state(self, state: ESKFState, altitude_m: float = 0.0) -> None: ...

    def notify_satellite_correction(self) -> None: ...

    def update_drift_estimate(self, drift_m: float) -> None: ...

    async def start(self, origin: GPSPoint) -> None: ...

    async def stop(self) -> None: ...

    def build_gps_input(self) -> Optional[GPSInputMessage]: ...
