"""Security utilities for Local Deep Research."""

from .data_sanitizer import (
    DataSanitizer,
    filter_research_metadata,
    redact_data,
    sanitize_data,
    strip_settings_snapshot,
)
from .security_settings import get_security_default
from .file_integrity import FileIntegrityManager, FAISSIndexVerifier
from .notification_validator import (
    NotificationURLValidator,
    NotificationURLValidationError,
)
from .safe_requests import safe_get, safe_post, SafeSession
from .security_headers import SecurityHeaders
from .ssrf_validator import validate_url, get_safe_url, is_ip_blocked
from .url_validator import URLValidator
from .account_lockout import AccountLockoutManager, get_account_lockout_manager
from .password_validator import PasswordValidator
from .log_sanitizer import sanitize_for_log, strip_control_chars
from .filename_sanitizer import sanitize_filename, UnsafeFilenameError
from .module_whitelist import (
    get_safe_module_class,
    ModuleNotAllowedError,
    ALLOWED_MODULES,
)

# PathValidator requires werkzeug (Flask dependency), import conditionally
try:
    from .path_validator import PathValidator

    _has_path_validator = True
except ImportError:
    PathValidator = None  # type: ignore
    _has_path_validator = False

# FileUploadValidator requires pdfplumber, import conditionally
try:
    from .file_upload_validator import FileUploadValidator

    _has_file_upload_validator = True
except ImportError:
    FileUploadValidator = None  # type: ignore
    _has_file_upload_validator = False

__all__ = [
    "PathValidator",
    "DataSanitizer",
    "sanitize_data",
    "redact_data",
    "filter_research_metadata",
    "strip_settings_snapshot",
    "get_security_default",
    "FileIntegrityManager",
    "FAISSIndexVerifier",
    "FileUploadValidator",
    "NotificationURLValidator",
    "NotificationURLValidationError",
    "SecurityHeaders",
    "URLValidator",
    "safe_get",
    "safe_post",
    "SafeSession",
    "validate_url",
    "get_safe_url",
    "is_ip_blocked",
    "get_safe_module_class",
    "ModuleNotAllowedError",
    "ALLOWED_MODULES",
    "AccountLockoutManager",
    "get_account_lockout_manager",
    "PasswordValidator",
    "sanitize_for_log",
    "strip_control_chars",
    "sanitize_filename",
    "UnsafeFilenameError",
]
