from abc import ABC, abstractmethod
import numpy as np

from models.processing import RelativePose, Matches


class SequentialVisualOdometryBase(ABC):
    @abstractmethod
    async def compute_relative_pose(
        self, prev_image: np.ndarray, curr_image: np.ndarray
    ) -> RelativePose:
        pass

    @abstractmethod
    async def extract_keypoints(
        self, image: np.ndarray
    ) -> tuple[np.ndarray, np.ndarray]:
        pass

    @abstractmethod
    async def match_features(
        self,
        keypoints1: np.ndarray,
        descriptors1: np.ndarray,
        keypoints2: np.ndarray,
        descriptors2: np.ndarray,
    ) -> Matches:
        pass

    @abstractmethod
    async def estimate_motion(
        self, matches: Matches, camera_matrix: np.ndarray
    ) -> RelativePose:
        pass

    @abstractmethod
    def is_tracking_good(self, pose: RelativePose) -> bool:
        pass

