# app/modules/analytics/exceptions.py
"""
Analytics module exceptions.

Module-specific exceptions for analytics functionality.
"""

from app.exceptions.base import (
    BusinessLogicException,
    ValidationException,
)


class ReportGenerationException(BusinessLogicException):  # noqa: MOD025
    """Raised when report generation fails."""

    def __init__(self, report_type: str, reason: str):
        super().__init__(
            message=f"Failed to generate {report_type} report: {reason}",
            error_code="REPORT_GENERATION_FAILED",
        )


class InvalidDateRangeException(ValidationException):  # noqa: MOD025
    """Raised when an invalid date range is provided."""

    def __init__(self, start_date: str, end_date: str):
        super().__init__(
            message=f"Invalid date range: {start_date} to {end_date}",
            field="date_range",
            value=f"{start_date} - {end_date}",
        )
        self.error_code = "INVALID_DATE_RANGE"


__all__ = [
    "ReportGenerationException",
    "InvalidDateRangeException",
]
