"""SDK exception hierarchy."""


class SDKError(Exception):
    """Base exception for all SDK errors."""


class ValidationError(SDKError):
    """Raised when workflow input validation fails."""


class CompilationError(SDKError):
    """Raised when Snowflake compilation fails."""


class ConnectionError(SDKError):
    """Raised when a Snowflake or backend connection fails."""


class WorkflowNotFoundError(SDKError):
    """Raised when a workflow name cannot be resolved."""


class StepError(SDKError):
    """Raised when a workflow step fails during execution."""

    def __init__(self, step_name: str, message: str):
        self.step_name = step_name
        super().__init__(f"Step '{step_name}' failed: {message}")


class AuditError(SDKError):
    """Raised when an audit logging operation fails."""


class LicenseError(SDKError):
    """Raised when a workflow requires a higher license tier."""


class NotImplementedStubError(SDKError):
    """Raised by stub methods that are not yet implemented.

    Includes guidance on which existing functions should be
    called when the stub is filled in.
    """

    def __init__(self, workflow: str, method: str, reuse_hint: str):
        self.workflow = workflow
        self.method = method
        self.reuse_hint = reuse_hint
        super().__init__(
            f"{workflow}.{method}() is a stub. "
            f"Implement by calling: {reuse_hint}"
        )
