"""
Database module for Telegram Bot

Provides SQLite database operations for:
- User management and Oracle account linking
- Authentication code management
- Conversation session management
"""

from .database import (
    init_database,
    get_db_connection,
    cleanup_expired_codes,
    cleanup_expired_sessions,
    cleanup_expired_email_codes,
    get_database_stats,
    DB_PATH,
)

from .operations import (
    # User operations
    create_or_update_user,
    get_user,
    link_user_to_oracle,
    update_user_tokens,
    update_user_last_active,
    is_user_linked,
    is_user_authenticated,
    # Auth code operations
    create_auth_code,
    get_auth_code,
    verify_and_use_auth_code,
    get_pending_codes_for_user,
    # Email auth code operations
    get_pending_email_code,
    create_email_auth_code,
    get_email_auth_code,
    increment_failed_attempts,
    mark_email_code_used,
    delete_user_email_codes,
    # Session operations
    create_session,
    get_session,
    get_user_active_session,
    update_session_state,
    delete_session,
    delete_user_sessions,
)

__all__ = [
    # Database setup
    'init_database',
    'get_db_connection',
    'cleanup_expired_codes',
    'cleanup_expired_sessions',
    'cleanup_expired_email_codes',
    'get_database_stats',
    'DB_PATH',
    # User operations
    'create_or_update_user',
    'get_user',
    'link_user_to_oracle',
    'update_user_tokens',
    'update_user_last_active',
    'is_user_linked',
    'is_user_authenticated',
    # Auth code operations
    'create_auth_code',
    'get_auth_code',
    'verify_and_use_auth_code',
    'get_pending_codes_for_user',
    # Email auth code operations
    'get_pending_email_code',
    'create_email_auth_code',
    'get_email_auth_code',
    'increment_failed_attempts',
    'mark_email_code_used',
    'delete_user_email_codes',
    # Session operations
    'create_session',
    'get_session',
    'get_user_active_session',
    'update_session_state',
    'delete_session',
    'delete_user_sessions',
]
