"""
Wrapper MongoDB-like interface dùng SQLite backend.

Cung cấp các attribute và methods tương tự MongoDB client để services.py
không cần thay đổi logic query nhiều (chỉ cần đổi từ .find_one() sang .find_one()).
"""

from common.sqlite_client import (
    sqlite_client as _sqlite_client,
    generate_uid,
    utc_now,
    serialize_row,
    parse_time,
    format_time,
    init_sqlite as init_mongodb,
    close_sqlite as close_mongodb,
)

# Re-export cho tương thích
mongodb_client = _sqlite_client

# Collection constants (re-export)
from common.sqlite_client import (
    TABLE_USERS as COLLECTION_USERS,
    TABLE_MEMOS as COLLECTION_MEMOS,
    TABLE_ATTACHMENTS as COLLECTION_ATTACHMENTS,
    TABLE_MEMO_RELATIONS as COLLECTION_MEMO_RELATIONS,
    TABLE_REACTIONS as COLLECTION_REACTIONS,
    TABLE_MEMO_EMBEDDINGS as COLLECTION_MEMO_EMBEDDINGS,
    TABLE_INBOX as COLLECTION_INBOX,
    TABLE_USER_SETTINGS as COLLECTION_USER_SETTINGS,
    TABLE_SHORTCUTS as COLLECTION_SHORTCUTS,
    TABLE_TEAMS as COLLECTION_TEAMS,
    TABLE_TEAM_MEMBERS as COLLECTION_TEAM_MEMBERS,
    TABLE_TEAM_MEMOS as COLLECTION_TEAM_MEMOS,
    TABLE_TEAM_COMMENTS as COLLECTION_TEAM_COMMENTS,
    TABLE_TEAM_REACTIONS as COLLECTION_TEAM_REACTIONS,
    TABLE_USER_PROFILES as COLLECTION_USER_PROFILES,
    TABLE_REFRESH_TOKENS as COLLECTION_REFRESH_TOKENS,
    TABLE_PERSONAL_ACCESS_TOKENS as COLLECTION_PERSONAL_ACCESS_TOKENS,
    TABLE_WEBHOOKS as COLLECTION_WEBHOOKS,
)

__all__ = [
    "mongodb_client",
    "generate_uid",
    "utc_now",
    "serialize_row",
    "parse_time",
    "format_time",
    "init_mongodb",
    "close_mongodb",
    "COLLECTION_MEMOS",
    "COLLECTION_ATTACHMENTS",
    "COLLECTION_MEMO_RELATIONS",
    "COLLECTION_REACTIONS",
    "COLLECTION_MEMO_EMBEDDINGS",
    "COLLECTION_INBOX",
    "COLLECTION_USER_SETTINGS",
    "COLLECTION_SHORTCUTS",
    "COLLECTION_TEAMS",
    "COLLECTION_TEAM_MEMBERS",
    "COLLECTION_TEAM_MEMOS",
    "COLLECTION_TEAM_COMMENTS",
    "COLLECTION_TEAM_REACTIONS",
    "COLLECTION_USER_PROFILES",
    "COLLECTION_USERS",
    "COLLECTION_REFRESH_TOKENS",
    "COLLECTION_PERSONAL_ACCESS_TOKENS",
    "COLLECTION_WEBHOOKS",
]
