from typing import Optional
import numpy as np

from .base import FactorGraphOptimizerBase
from models.core import Pose, GPSPoint
from models.results import OptimizationResult, RefinedFrameResult
from models.processing import RelativePose


class FactorGraphOptimizer(FactorGraphOptimizerBase):
    async def initialize_graph(self, flight_id: str) -> bool:
        raise NotImplementedError

    async def add_odometry_factor(
        self,
        flight_id: str,
        from_frame: int,
        to_frame: int,
        relative_pose: RelativePose,
    ) -> bool:
        raise NotImplementedError

    async def add_gps_prior(
        self,
        flight_id: str,
        frame_id: int,
        gps: GPSPoint,
        covariance: np.ndarray,
    ) -> bool:
        raise NotImplementedError

    async def optimize(
        self, flight_id: str, max_iterations: int = 100
    ) -> OptimizationResult:
        raise NotImplementedError

    async def get_optimized_poses(
        self, flight_id: str
    ) -> list[RefinedFrameResult]:
        raise NotImplementedError

    async def get_pose(
        self, flight_id: str, frame_id: int
    ) -> Optional[Pose]:
        raise NotImplementedError

    async def marginalize_old_poses(
        self, flight_id: str, keep_last_n: int
    ) -> bool:
        raise NotImplementedError

