# -*- coding: utf-8 -*-
"""Base algorithm interface for TopoFix topology checks.

Every algorithm inherits from BaseChecker and implements
check() for detection and fix() for correction.

Scientific basis:
    OGC Simple Feature (ISO 19125) defines spatial relationships.
    GEOS (libgeos.org) provides the computational geometry engine.

Author: Loc Vu Trung tong hop vi dam me cung ban!
"""

from abc import ABC, abstractmethod


class BaseChecker(ABC):
    """Abstract base for topology check/fix algorithms.

    Attributes:
        name: Internal identifier (e.g. "overlaps").
        display_name_en: English display name.
        display_name_vi: Vietnamese display name.
        description_en: English description.
        description_vi: Vietnamese description.
    """

    name = ""
    display_name_en = ""
    display_name_vi = ""
    description_en = ""
    description_vi = ""

    @abstractmethod
    def check(self, layer, params):
        """Detect topology errors in a polygon layer.

        Args:
            layer: QgsVectorLayer (polygon type).
            params: Dict of parameters (tolerance, thresholds).

        Returns:
            dict with keys:
                error_geometries: list of QgsGeometry objects
                error_features: list of QgsFeature objects
                details: list of description strings
        """
        pass  # nosec B110

    @abstractmethod
    def fix(self, input_path, output_path, params):
        """Fix detected topology errors.

        Args:
            input_path: Path to input shapefile/gpkg.
            output_path: Path to write corrected output.
            params: Same parameters dict as check().

        Returns:
            str: Path to the corrected output file.
        """
        pass  # nosec B110
