"""SQLite database models and queries for twag."""

from .accounts import (
    apply_account_decay,
    boost_account,
    demote_account,
    get_accounts,
    mute_account,
    promote_account,
    update_account_last_fetched,
    update_account_stats,
    upsert_account,
)
from .connection import get_connection, init_db, rebuild_fts
from .context_commands import (
    ContextCommand,
    delete_context_command,
    get_all_context_commands,
    get_context_command,
    toggle_context_command,
    upsert_context_command,
)
from .maintenance import (
    _filter_fts_from_sql,
    _is_fts_statement,
    dump_sql,
    prune_old_tweets,
    restore_sql,
)
from .narratives import (
    archive_stale_narratives,
    get_active_narratives,
    link_tweet_narrative,
    upsert_narrative,
)
from .prompts import (
    DEFAULT_PROMPTS,
    Prompt,
    get_all_prompts,
    get_prompt,
    get_prompt_history,
    rollback_prompt,
    seed_prompts,
    upsert_prompt,
)
from .reactions import (
    Reaction,
    delete_reaction,
    get_reactions_for_tweet,
    get_reactions_summary,
    get_reactions_with_tweets,
    insert_reaction,
)
from .schema import FTS_SCHEMA, SCHEMA
from .search import (
    EQUITY_KEYWORDS,
    FeedTweet,
    SearchResult,
    get_feed_tweets,
    query_suggests_equity_context,
    search_tweets,
)
from .time_utils import (
    _get_et_offset,
    get_market_day_cutoff,
    parse_time_range,
)
from .tweets import (
    get_authors_to_promote,
    get_bookmark_counts_by_author,
    get_last_fetch,
    get_processed_counts,
    get_tweet_by_id,
    get_tweet_stats,
    get_tweets_by_ids,
    get_tweets_for_digest,
    get_unprocessed_tweets,
    insert_tweet,
    is_tweet_seen,
    log_fetch,
    mark_tweet_bookmarked,
    mark_tweet_in_digest,
    migrate_seen_json,
    update_tweet_analysis,
    update_tweet_article,
    update_tweet_enrichment,
    update_tweet_links_expanded,
    update_tweet_processing,
)

__all__ = [
    "DEFAULT_PROMPTS",
    "EQUITY_KEYWORDS",
    "FTS_SCHEMA",
    "SCHEMA",
    "ContextCommand",
    "FeedTweet",
    "Prompt",
    "Reaction",
    "SearchResult",
    "_filter_fts_from_sql",
    "_get_et_offset",
    "_is_fts_statement",
    "apply_account_decay",
    "archive_stale_narratives",
    "boost_account",
    "delete_context_command",
    "delete_reaction",
    "demote_account",
    "dump_sql",
    "get_accounts",
    "get_active_narratives",
    "get_all_context_commands",
    "get_all_prompts",
    "get_authors_to_promote",
    "get_bookmark_counts_by_author",
    "get_connection",
    "get_context_command",
    "get_feed_tweets",
    "get_last_fetch",
    "get_market_day_cutoff",
    "get_processed_counts",
    "get_prompt",
    "get_prompt_history",
    "get_reactions_for_tweet",
    "get_reactions_summary",
    "get_reactions_with_tweets",
    "get_tweet_by_id",
    "get_tweet_stats",
    "get_tweets_by_ids",
    "get_tweets_for_digest",
    "get_unprocessed_tweets",
    "init_db",
    "insert_reaction",
    "insert_tweet",
    "is_tweet_seen",
    "link_tweet_narrative",
    "log_fetch",
    "mark_tweet_bookmarked",
    "mark_tweet_in_digest",
    "migrate_seen_json",
    "mute_account",
    "parse_time_range",
    "promote_account",
    "prune_old_tweets",
    "query_suggests_equity_context",
    "rebuild_fts",
    "restore_sql",
    "rollback_prompt",
    "search_tweets",
    "seed_prompts",
    "toggle_context_command",
    "update_account_last_fetched",
    "update_account_stats",
    "update_tweet_analysis",
    "update_tweet_article",
    "update_tweet_enrichment",
    "update_tweet_links_expanded",
    "update_tweet_processing",
    "upsert_account",
    "upsert_context_command",
    "upsert_narrative",
    "upsert_prompt",
]
