"""
Document Freshness Error Codes

Standardized error codes for document freshness monitoring operations.
Provides type-safe error handling throughout the system.
"""

from enum import Enum, unique

from omnibase_core.utils.util_str_enum_base import StrValueHelper


@unique
class EnumDocumentFreshnessErrors(StrValueHelper, str, Enum):
    """
    Standardized error codes for document freshness monitoring.

    All error codes follow the pattern: FRESHNESS_<CATEGORY>_<SPECIFIC_ERROR>
    """

    # === PATH VALIDATION ERRORS ===
    FRESHNESS_PATH_NOT_FOUND = "FRESHNESS_PATH_NOT_FOUND"
    FRESHNESS_PATH_INVALID = "FRESHNESS_PATH_INVALID"
    FRESHNESS_PATH_ACCESS_DENIED = "FRESHNESS_PATH_ACCESS_DENIED"
    FRESHNESS_PATH_TOO_LONG = "FRESHNESS_PATH_TOO_LONG"
    FRESHNESS_PATH_FORBIDDEN_PATTERN = "FRESHNESS_PATH_FORBIDDEN_PATTERN"

    # === DATABASE ERRORS ===
    FRESHNESS_DATABASE_INIT_FAILED = "FRESHNESS_DATABASE_INIT_FAILED"
    FRESHNESS_DATABASE_CONNECTION_FAILED = "FRESHNESS_DATABASE_CONNECTION_FAILED"
    FRESHNESS_DATABASE_QUERY_FAILED = "FRESHNESS_DATABASE_QUERY_FAILED"
    FRESHNESS_DATABASE_WRITE_FAILED = "FRESHNESS_DATABASE_WRITE_FAILED"
    FRESHNESS_DATABASE_SCHEMA_INVALID = "FRESHNESS_DATABASE_SCHEMA_INVALID"

    # === ANALYSIS ERRORS ===
    FRESHNESS_ANALYSIS_FAILED = "FRESHNESS_ANALYSIS_FAILED"
    FRESHNESS_ANALYSIS_TIMEOUT = "FRESHNESS_ANALYSIS_TIMEOUT"
    FRESHNESS_ANALYSIS_MEMORY_EXCEEDED = "FRESHNESS_ANALYSIS_MEMORY_EXCEEDED"
    FRESHNESS_ANALYSIS_FILE_TOO_LARGE = "FRESHNESS_ANALYSIS_FILE_TOO_LARGE"
    FRESHNESS_ANALYSIS_INVALID_CONFIG = "FRESHNESS_ANALYSIS_INVALID_CONFIG"

    # === AI SERVICE ERRORS ===
    FRESHNESS_AI_SERVICE_UNAVAILABLE = "FRESHNESS_AI_SERVICE_UNAVAILABLE"
    FRESHNESS_AI_SERVICE_ERROR = "FRESHNESS_AI_SERVICE_ERROR"
    FRESHNESS_AI_RATE_LIMIT_EXCEEDED = "FRESHNESS_AI_RATE_LIMIT_EXCEEDED"
    FRESHNESS_AI_CONTENT_TOO_LARGE = "FRESHNESS_AI_CONTENT_TOO_LARGE"
    FRESHNESS_AI_QUALITY_THRESHOLD_NOT_MET = "FRESHNESS_AI_QUALITY_THRESHOLD_NOT_MET"

    # === DEPENDENCY ANALYSIS ERRORS ===
    FRESHNESS_DEPENDENCY_ANALYSIS_FAILED = "FRESHNESS_DEPENDENCY_ANALYSIS_FAILED"
    FRESHNESS_DEPENDENCY_CIRCULAR_DETECTED = "FRESHNESS_DEPENDENCY_CIRCULAR_DETECTED"
    FRESHNESS_DEPENDENCY_DEPTH_EXCEEDED = "FRESHNESS_DEPENDENCY_DEPTH_EXCEEDED"
    FRESHNESS_DEPENDENCY_PARSING_FAILED = "FRESHNESS_DEPENDENCY_PARSING_FAILED"

    # === CHANGE DETECTION ERRORS ===
    FRESHNESS_CHANGE_DETECTION_FAILED = "FRESHNESS_CHANGE_DETECTION_FAILED"
    FRESHNESS_GIT_UNAVAILABLE = "FRESHNESS_GIT_UNAVAILABLE"
    FRESHNESS_GIT_OPERATION_FAILED = "FRESHNESS_GIT_OPERATION_FAILED"
    FRESHNESS_CHANGE_HISTORY_CORRUPTED = "FRESHNESS_CHANGE_HISTORY_CORRUPTED"

    # === VALIDATION ERRORS ===
    FRESHNESS_VALIDATION_FAILED = "FRESHNESS_VALIDATION_FAILED"
    FRESHNESS_CONFIG_INVALID = "FRESHNESS_CONFIG_INVALID"
    FRESHNESS_INPUT_INVALID = "FRESHNESS_INPUT_INVALID"
    FRESHNESS_OUTPUT_VALIDATION_FAILED = "FRESHNESS_OUTPUT_VALIDATION_FAILED"

    # === SYSTEM ERRORS ===
    FRESHNESS_SYSTEM_ERROR = "FRESHNESS_SYSTEM_ERROR"
    FRESHNESS_PERMISSION_DENIED = "FRESHNESS_PERMISSION_DENIED"
    FRESHNESS_RESOURCE_EXHAUSTED = "FRESHNESS_RESOURCE_EXHAUSTED"
    FRESHNESS_OPERATION_CANCELLED = "FRESHNESS_OPERATION_CANCELLED"


__all__ = ["EnumDocumentFreshnessErrors"]
