"""ESKFState hot-path dataclass (ARCH-02).

Returned by `ESKF.get_state()` every frame. ConfidenceTier stays in
schemas/eskf.py as an enum (boundary), and we import it here for the
`confidence` field type.

eq=False because numpy arrays in `__eq__` would raise; Pydantic was already
incomparable for this model.
"""

from __future__ import annotations

from dataclasses import dataclass
from typing import Optional

import numpy as np

from gps_denied.schemas.eskf import ConfidenceTier


@dataclass(slots=True, frozen=True, eq=False)
class ESKFState:
    """Full ESKF nominal state snapshot."""

    position: np.ndarray       # (3,) ENU meters from origin (East, North, Up)
    velocity: np.ndarray       # (3,) ENU m/s
    quaternion: np.ndarray     # (4,) [w, x, y, z] body-to-ENU
    accel_bias: np.ndarray     # (3,) m/s^2
    gyro_bias: np.ndarray      # (3,) rad/s
    covariance: np.ndarray     # (15, 15)
    timestamp: float           # seconds since epoch
    confidence: ConfidenceTier
    last_satellite_time: Optional[float] = None
    last_vo_time: Optional[float] = None
