"""Base exceptions for domain layer.

This module defines the exception hierarchy for the domain layer.
"""


class PeikarbandException(Exception):
    """Base exception for all custom exceptions."""
    
    def __init__(self, message: str, code: str = "INTERNAL_ERROR"):
        """Initialize exception.
        
        Args:
            message: Error message
            code: Error code
        """
        self.message = message
        self.code = code
        super().__init__(self.message)


class DomainException(PeikarbandException):
    """Base exception for domain layer."""
    
    def __init__(self, message: str, code: str = "DOMAIN_ERROR"):
        """Initialize domain exception.
        
        Args:
            message: Error message
            code: Error code
        """
        super().__init__(message, code)


class ValidationException(DomainException):
    """Validation error in domain."""
    
    def __init__(self, message: str, field: str = ""):
        """Initialize validation exception.
        
        Args:
            message: Error message
            field: Field that failed validation
        """
        self.field = field
        super().__init__(message, "VALIDATION_ERROR")


class BusinessRuleException(DomainException):
    """Business rule violation."""
    
    def __init__(self, message: str):
        """Initialize business rule exception.
        
        Args:
            message: Error message
        """
        super().__init__(message, "BUSINESS_RULE_VIOLATION")

