from dataclasses import dataclass
from typing import Optional


@dataclass
class Detection:
    TYPE_NAME = "detection"

    def __init__(self) -> None:
        pass

    def __hash__(self) -> int:
        return (type(self), *(self.__dict__.values())).__hash__()


class MorphosyntacticInfoMixin:
    def __init__(self, morpho_tag: str, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self._morpho_tag = morpho_tag

    @property
    def morpho_tag(self) -> str:
        return self._morpho_tag


class NameDetection(MorphosyntacticInfoMixin, Detection):
    TYPE_NAME = "name"

    def __init__(self, morpho_tag: Optional[str] = None) -> None:
        super().__init__(morpho_tag=morpho_tag)


class SurnameDetection(MorphosyntacticInfoMixin, Detection):
    TYPE_NAME = "surname"

    def __init__(self, morpho_tag: Optional[str] = None) -> None:
        super().__init__(morpho_tag=morpho_tag)


class StreetNameDetection(MorphosyntacticInfoMixin, Detection):
    TYPE_NAME = "street_name"

    def __init__(self, morpho_tag: Optional[str] = None) -> None:
        super().__init__(morpho_tag=morpho_tag)


class CityDetection(MorphosyntacticInfoMixin, Detection):
    TYPE_NAME = "city"

    def __init__(self, morpho_tag: Optional[str] = None) -> None:
        super().__init__(morpho_tag=morpho_tag)


class CountryDetection(MorphosyntacticInfoMixin, Detection):
    TYPE_NAME = "country"

    def __init__(self, morpho_tag: Optional[str] = None) -> None:
        super().__init__(morpho_tag=morpho_tag)


class UrlDetection(Detection):
    TYPE_NAME = "url"

    def __init__(self) -> None:
        super().__init__()


class UserDetection(Detection):
    TYPE_NAME = "user"

    def __init__(self) -> None:
        super().__init__()


class EmailDetection(Detection):
    TYPE_NAME = "email"

    def __init__(self) -> None:
        super().__init__()


class NumberDetection(Detection):
    TYPE_NAME = "number"

    def __init__(self) -> None:
        super().__init__()


class PhoneNumberDetection(NumberDetection):
    TYPE_NAME = "phone_number"

    def __init__(self) -> None:
        super().__init__()


class TINDetection(Detection):  # Tax Identification Number
    TYPE_NAME = "tin"

    def __init__(self) -> None:
        super().__init__()


class KRSDetection(Detection):  # National Court Register
    TYPE_NAME = "krs"

    def __init__(self) -> None:
        super().__init__()


class OtherDetection(Detection):  # Non standard entity
    TYPE_NAME = "other"

    def __init__(self) -> None:
        super().__init__()