"""Metric refinement hot-path dataclasses (ARCH-02).

AlignmentResult, ChunkAlignmentResult, Sim3Transform — all returned per
satellite-match frame.

`gps_center` composes the still-Pydantic GPSPoint (deferred per
PATTERNS.md §6.3); composition is fine.

eq=False on every dataclass with np.ndarray fields.
"""

from __future__ import annotations

from dataclasses import dataclass

import numpy as np

from gps_denied.schemas import GPSPoint


@dataclass(slots=True, frozen=True, eq=False)
class AlignmentResult:
    """Result of aligning a UAV image to a single satellite tile."""

    matched: bool
    homography: np.ndarray         # (3, 3)
    gps_center: GPSPoint
    confidence: float
    inlier_count: int
    total_correspondences: int
    reprojection_error: float      # Mean error in pixels


@dataclass(slots=True, frozen=True, eq=False)
class Sim3Transform:
    """Sim(3) transformation: scale, rotation, translation."""

    translation: np.ndarray        # (3,)
    rotation: np.ndarray           # (3, 3) rotation matrix
    scale: float


@dataclass(slots=True, frozen=True, eq=False)
class ChunkAlignmentResult:
    """Result of aligning a chunk array of UAV images to a satellite tile."""

    matched: bool
    chunk_id: str
    chunk_center_gps: GPSPoint
    rotation_angle: float
    confidence: float
    inlier_count: int
    transform: Sim3Transform
    reprojection_error: float
