"""
Validation result models for the generate package.
"""

from dataclasses import dataclass
from typing import Optional


@dataclass
class ValidationResult:
    """Result of a validation check."""
    
    success: bool
    message: str
    details: Optional[dict] = None
    
    @classmethod
    def success_result(cls, message: str, details: Optional[dict] = None) -> "ValidationResult":
        """Create a successful validation result."""
        return cls(success=True, message=message, details=details)
    
    @classmethod
    def fail(cls, message: str, details: Optional[dict] = None) -> "ValidationResult":
        """Create a failed validation result."""
        return cls(success=False, message=message, details=details)


class ValidationError(Exception):
    """Exception raised when validation fails."""
    
    def __init__(self, message: str, validation_result: Optional[ValidationResult] = None):
        super().__init__(message)
        self.validation_result = validation_result