from enum import Enum
from typing import Callable, Union, List, Optional

from numpy.typing import NDArray
from shapely import Polygon, MultiPolygon

from .contour import contour_inward, contour_outward
from ..beams import BeamType
from ..mill import Mill

_method_map = {1: contour_inward, 2: contour_outward}
_method_signature = Callable[[Union[Polygon, MultiPolygon], Mill, BeamType, Optional[bool]], List[NDArray]]


class ScanStyle(Enum):

    contour_inward = 1
    contour_outward = 2

    @property
    def value(self) -> _method_signature:
        """Override value to return the corresponding function instead of the integer."""
        return _method_map[super().value]