/**
 * Player Database Operations
 *
 * Functions for loading and saving player data to MySQL.
 * Matches Python server's database/db_operations.py functionality.
 */
import { Player } from '../models/Player.js';
import type { RowDataPacket } from 'mysql2/promise';
/**
 * Save a player to the database.
 * Uses REPLACE INTO for upsert behavior.
 *
 * NOTE: Conversations are stored in dedicated `conversations` table only,
 * not in the JSON blob. This prevents dual-storage sync issues.
 */
export declare function savePlayer(player: Player): Promise<void>;
/**
 * Async version matching Python's saveGameAsync
 */
export declare function saveGameAsync(player: Player): Promise<void>;
/**
 * Load a player from the database by ID.
 *
 * NOTE: This does NOT load conversations - call loadPlayerConversations()
 * separately to load conversations from the dedicated table.
 */
export declare function loadPlayer(playerId: string): Promise<Player | null>;
/**
 * Async version matching Python's loadGameAsync
 */
export declare function loadGameAsync(playerId: string): Promise<Player | null>;
/**
 * Load all player IDs from the database.
 * Used by iterateGames to process offline players.
 */
export declare function loadAllPlayerIds(): Promise<Array<{
    playerId: string;
}>>;
/**
 * Load all players (for offline iteration)
 * Matches Python's loadGames()
 */
export declare function loadGames(): Promise<Array<{
    playerId: string;
}>>;
/**
 * Update only the connection_status column for a player.
 * Used to immediately mark a player as connected when they establish a WebSocket session,
 * preventing the background offline-iteration job from picking them up.
 */
export declare function updateConnectionStatus(playerId: string, status: string): Promise<void>;
interface ConversationRow extends RowDataPacket {
    id: string;
    player_id: string;
    character_id: string;
    messages: string;
    created_at: Date;
    updated_at: Date;
    unread: boolean;
}
/**
 * Save a conversation message to the database.
 */
export declare function saveConversationMessage(playerId: string, characterId: string, conversationId: string, message: string, sender: 'player' | 'character'): Promise<void>;
/**
 * Save entire conversation to database.
 */
export declare function saveConversation(playerId: string, characterId: string, conversationId: string, messages: unknown[], unread: boolean): Promise<void>;
/**
 * Load conversations for a player (raw rows from table).
 */
export declare function loadConversations(playerId: string): Promise<ConversationRow[]>;
/**
 * Load player conversations from the dedicated conversations table.
 *
 * This is the single source of truth for conversations. It also handles migration
 * from the JSON blob for any conversations that exist there but not in the table.
 *
 * @returns Array of conversation objects ready to assign to player.conversations
 */
export declare function loadPlayerConversations(playerId: string): Promise<Array<{
    id: string;
    character: string;
    cType: string;
    conversation: unknown[];
    question: number;
    unread: boolean;
    summary?: string;
    summary_message_count?: number;
}>>;
/**
 * Mark a conversation as read.
 */
export declare function markConversationAsRead(conversationId: string, playerId: string): Promise<void>;
/**
 * Ensure required tables exist.
 * Call on server startup.
 */
export declare function ensureTables(): Promise<void>;
export {};
//# sourceMappingURL=players.d.ts.map