# -*- coding: utf-8 -*-
"""Algorithm registry — fix order is critical.

Output of step N becomes input of step N+1.
Multipart MUST be first (changes feature count).
"""
from .multipart import MultipartChecker
from .invalid import InvalidChecker
from .unclosed import UnclosedChecker
from .duplicates import DuplicateChecker
from .overlaps import OverlapChecker
from .must_not_overlap import MustNotOverlapChecker
from .gaps import GapChecker
from .redundant import RedundantChecker
from .sliver import SliverChecker
from .missing_nodes import MissingNodeChecker
from .tiny_polygon import TinyPolygonChecker

# Mandatory fix order — do NOT rearrange
FIX_ORDER = [
    MultipartChecker,       # 1. Split multipart first
    InvalidChecker,         # 2. Fix invalid geometry
    UnclosedChecker,        # 3. Close rings
    DuplicateChecker,       # 4. Remove duplicates
    OverlapChecker,         # 5. Cut overlaps
    MustNotOverlapChecker,  # 6. Smart cut by area
    GapChecker,             # 7. Fill gaps
    RedundantChecker,       # 8. Reduce vertices
    SliverChecker,          # 9. Remove slivers
    MissingNodeChecker,     # 10. Insert missing nodes
    TinyPolygonChecker,     # 11. Merge tiny polygons
]

ALL_CHECKERS = {cls.name: cls for cls in FIX_ORDER}
