from helper import ExtendedEnum
from typing import Any


class ValidationError(Exception):
    def __init__(
            self,
            ex,     # type: ExtendedEnum
            *args   # type: Any
    ):
        # type: (...) -> None

        self.error_type = ex.name
        if args:
            self.error_message = ex.value.format(*args)
        else:
            self.error_message = ex.value


class AuthValidationErrors(Exception):
    def __init__(self, ex):
        # type: (ExtendedEnum) -> None
        self.error_type = ex.name
        self.error_message = ex.value


class ExternalServiceErrors(Exception):
    def __init__(
            self,
            ex,     # type: ExtendedEnum
            *args   # type: Any
    ):
        # type: (...) -> None

        self.error_type = ex.name
        if args:
            self.error_message = ex.value.format(*args)
        else:
            self.error_message = ex.value


class OperationErrors(Exception):
    def __init__(self, ex):
        # type: (ExtendedEnum) -> None
        self.error_type = ex.name
        self.error_message = ex.value


class BadRequestError(Exception):
    def __init__(
            self,
            ex,     # type: ExtendedEnum
            *args   # type: Any
    ):
        # type: (...) -> None

        self.error_type = ex.name
        if args:
            self.error_message = ex.value.format(*args)
        else:
            self.error_message = ex.value


class NotFoundError(Exception):
    def __init__(
            self,
            ex,     # type: ExtendedEnum
            *args   # type: Any
    ):
        # type: (...) -> None

        self.error_type = ex.name
        if args:
            self.error_message = ex.value.format(*args)
        else:
            self.error_message = ex.value


class ClientCustomError(Exception):
    def __init__(
            self,
            ex,     # type: ExtendedEnum
            *args   # type: Any
    ):
        # type: (...) -> None

        self.error_type = ex.name
        if args:
            self.error_message = ex.value.format(*args)
        else:
            self.error_message = ex.value


class InUseError(Exception):
    def __init__(
            self,
            ex,     # type: ExtendedEnum
            *args   # type: Any
    ):
        # type: (...) -> None

        self.error_type = ex.name
        if args:
            self.error_message = ex.value.format(*args)
        else:
            self.error_message = ex.value


class NotAvailableError(Exception):
    def __init__(
            self,
            ex,     # type: ExtendedEnum
            *args   # type: Any
    ):
        # type: (...) -> None

        self.error_type = ex.name
        if args:
            self.error_message = ex.value.format(*args)
        else:
            self.error_message = ex.value
