"""
Unified Inbox Mail Database Service

Barrel re-export -- the actual logic lives in:
- mail_db_pool.py: Connection pool and schema initialization
- mail_db_accounts.py: Email account CRUD
- mail_db_emails.py: Aggregated email operations
- mail_db_tasks.py: Inbox task operations
- mail_db_stats.py: Statistics and audit log
"""

from .mail_db_pool import get_pool, init_mail_tables

from .mail_db_accounts import (
    create_email_account,
    get_email_accounts,
    get_email_account,
    update_account_status,
    delete_email_account,
)

from .mail_db_emails import (
    upsert_email,
    get_unified_inbox,
    get_email,
    update_email_ai_analysis,
    mark_email_read,
    mark_email_starred,
)

from .mail_db_tasks import (
    create_task,
    get_tasks,
    get_task,
    update_task,
    get_task_dashboard_stats,
)

from .mail_db_stats import (
    get_mail_stats,
    log_mail_audit,
)

__all__ = [
    # Pool
    "get_pool",
    "init_mail_tables",
    # Accounts
    "create_email_account",
    "get_email_accounts",
    "get_email_account",
    "update_account_status",
    "delete_email_account",
    # Emails
    "upsert_email",
    "get_unified_inbox",
    "get_email",
    "update_email_ai_analysis",
    "mark_email_read",
    "mark_email_starred",
    # Tasks
    "create_task",
    "get_tasks",
    "get_task",
    "update_task",
    "get_task_dashboard_stats",
    # Stats
    "get_mail_stats",
    "log_mail_audit",
]
