"""Feature-system protocol definitions."""

from __future__ import annotations

from typing import TYPE_CHECKING, Protocol

if TYPE_CHECKING:
    from distfeat.representations import FeatureRepresentation


class FeatureSystem(Protocol):
    """Protocol all feature-system implementations must satisfy."""

    @property
    def name(self) -> str: ...

    @property
    def representation_kind(self) -> str: ...

    def list_graphemes(self) -> tuple[str, ...]: ...

    def grapheme_to_representation(self, grapheme: str) -> FeatureRepresentation | None: ...

    def grapheme_to_features(self, grapheme: str) -> frozenset[str] | None: ...

    def features_to_grapheme(self, features: object) -> str | None: ...

    def is_class(self, grapheme: str) -> bool: ...

    def class_representation(self, grapheme: str) -> FeatureRepresentation | None: ...

    def class_features(self, grapheme: str) -> frozenset[str] | None: ...

    def add_features(self, base: frozenset[str], added: frozenset[str]) -> frozenset[str]: ...

    def matches(self, pattern: object, target: object) -> bool: ...

    def partial_match(self, pattern: frozenset[str], target: frozenset[str]) -> bool: ...

    def feature_distance(self, feat_a: str, feat_b: str) -> float: ...

    def segment_distance(self, a: object, b: object) -> float: ...

    def sound_distance(self, feats_a: frozenset[str], feats_b: frozenset[str]) -> float: ...
