from typing import Any
from enum import Enum


class AccountBaseException(Exception):
    def __init__(
        self,
        code: str,
        message_out: Any,
        status_code: int,
        details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class AuthenticationError(AccountBaseException):
    def __init__(
        self,
        code: str = "AUE",
        message_out: Any = "Authentication-Error",
        status_code: int = 403,
            details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class DatabaseError(AccountBaseException):
    def __init__(
        self,
        code: str = "DBE",
        message_out: Any = "Database Error",
        status_code: int = 500,
            details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details

class ValidationError(AccountBaseException):
    def __init__(
        self,
        code: str = "VAE",
        message_out: Any = "Validation Error",
        status_code: int = 403,
        details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class ServiceIntegrationsError(AccountBaseException):
    def __init__(
        self,
        code: str = "SIE",
        message_out: Any = "Service Integrations Error",
        status_code: int = 500,
        details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class ResourceNotFoundError(AccountBaseException):
    def __init__(
        self,
        code: str = "RNFE",
        message_out: Any = "Resource Not Found Error",
        status_code: int = 500,
        details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class ConcurrencyLockError(AccountBaseException):
    def __init__(
        self,
        code: str = "CLE",
        message_out: Any = "Concurrency Lock Error",
        status_code: int = 404,
        details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class RateLimitError(AccountBaseException):
    def __init__(
        self,
        code: str = "RLE",
        message_out: Any = "Rate Limit Error",
        status_code: int = 403,
            details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class ConfigurationsError(AccountBaseException):
    def __init__(
        self,
        code: str = "COE",
        message_out: Any = "Configurations Error",
        status_code: int = 403,
            details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class SecurityViolationsError(AccountBaseException):
    def __init__(
        self,
        code: str = "SVE",
        message_out: Any = "Security Violations Error",
        status_code: int = 403,
            details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class PolicyViolationError(AccountBaseException):
    def __init__(
        self,
        code: str = "PVE",
        message_out: Any = "Policy Violation Error",
        status_code: int = 403,
            details: dict = None,
    ):
        self.code = code
        self.message_out = message_out
        self.status_code = status_code
        self.details = details


class ErrorMessage(Enum):
    rpc_error = "could not connect to server"
    operation_error = "operation not allowed"
