/**
 * Analytics Manager
 *
 * Core analytics tracking system for player actions and events.
 * Supports event batching, session tracking, and database persistence.
 *
 * Ported from Python: ws/analytics/events.py
 */
import { AnalyticsEvent, AnalyticsSession, EventCategory, EventProperties, EventName, EventBufferConfig } from './events.js';
/**
 * Main analytics tracking class.
 * Handles event tracking, session management, and batched persistence.
 */
export declare class AnalyticsTracker {
    private sessions;
    private eventBuffer;
    private config;
    private flushTimer;
    private initialized;
    constructor(config?: Partial<EventBufferConfig>);
    /**
     * Initialize the analytics system, creating necessary tables.
     */
    initialize(): Promise<void>;
    /**
     * Register analytics flush job with background job manager.
     */
    registerFlushJob(): void;
    /**
     * Start a new analytics session for a player.
     */
    startSession(playerId: string, platform?: string, appVersion?: string): Promise<string>;
    /**
     * End the current session for a player.
     */
    endSession(playerId: string): Promise<void>;
    /**
     * Get the current session ID for a player.
     */
    getSessionId(playerId: string): string | null;
    /**
     * Track an analytics event.
     */
    trackEvent(playerId: string, eventName: EventName | string, properties?: EventProperties | null): void;
    /**
     * Track purchase initiated event.
     */
    trackPurchaseInitiated(playerId: string, itemId: string, price: number, currency?: string): void;
    /**
     * Track purchase completed event.
     */
    trackPurchaseCompleted(playerId: string, itemId: string, price: number, currency?: string, transactionId?: string): void;
    /**
     * Track conversation sent event.
     */
    trackConversationSent(playerId: string, npcId: string, messageType: string): void;
    /**
     * Track level up event.
     */
    trackLevelUp(playerId: string, newLevel: number, category?: string): void;
    /**
     * Track tutorial step event.
     */
    trackTutorialStep(playerId: string, stepName: string, completed?: boolean): void;
    /**
     * Track relationship milestone event.
     */
    trackRelationshipMilestone(playerId: string, npcId: string, relationshipType: string, affinityLevel: number): void;
    /**
     * Track character death event.
     */
    trackDeath(playerId: string, age: number, cause: string): void;
    /**
     * Track achievement unlocked event.
     */
    trackAchievementUnlocked(playerId: string, achievementKey: string, category: string): void;
    /**
     * Track daily login event.
     */
    trackDailyLogin(playerId: string, streakDays: number): void;
    /**
     * Track daily quest completed event.
     */
    trackDailyQuestCompleted(playerId: string, questType: string, rewardType: string, rewardAmount: number): void;
    /**
     * Track money earned event.
     */
    trackMoneyEarned(playerId: string, amount: number, source: string): void;
    /**
     * Track money spent event.
     */
    trackMoneySpent(playerId: string, amount: number, category: string): void;
    /**
     * Track job obtained event.
     */
    trackJobObtained(playerId: string, jobId: string, jobTitle: string): void;
    /**
     * Track game start event.
     */
    trackGameStart(playerId: string, characterAge?: number): void;
    /**
     * Flush buffered events to database.
     */
    flush(): Promise<void>;
    /**
     * Start the auto-flush timer.
     */
    private startFlushTimer;
    /**
     * Stop the auto-flush timer.
     */
    stopFlushTimer(): void;
    /**
     * Get buffer stats.
     */
    getBufferStats(): {
        size: number;
        maxSize: number;
    };
    /**
     * Get events for a player.
     */
    getPlayerEvents(playerId: string, options?: {
        limit?: number;
        offset?: number;
        eventName?: string;
        category?: EventCategory;
        startTime?: number;
        endTime?: number;
    }): Promise<AnalyticsEvent[]>;
    /**
     * Get event count for a player.
     */
    getEventCount(playerId: string, eventName?: string, startTime?: number, endTime?: number): Promise<number>;
    /**
     * Get player sessions.
     */
    getPlayerSessions(playerId: string, limit?: number): Promise<AnalyticsSession[]>;
    /**
     * Get aggregate metrics for a player.
     */
    getPlayerMetrics(playerId: string): Promise<{
        totalSessions: number;
        totalEvents: number;
        totalPlayTime: number;
        firstSeen: number | null;
        lastSeen: number | null;
        eventsByCategory: Record<EventCategory, number>;
    }>;
    /**
     * Delete old analytics data.
     */
    cleanupOldData(daysToKeep?: number): Promise<number>;
    /**
     * Clear all data for a player.
     */
    clearPlayerData(playerId: string): Promise<void>;
    /**
     * Shutdown the tracker gracefully.
     */
    shutdown(): Promise<void>;
}
/**
 * Get or create the global analytics tracker instance.
 */
export declare function getTracker(config?: Partial<EventBufferConfig>): AnalyticsTracker;
/**
 * Initialize the global tracker.
 */
export declare function initializeAnalytics(config?: Partial<EventBufferConfig>): Promise<AnalyticsTracker>;
/**
 * Track an event (convenience function).
 */
export declare function trackEvent(playerId: string, eventName: EventName | string, properties?: EventProperties | null): void;
/**
 * Track purchase initiated (convenience function).
 */
export declare function trackPurchaseInitiated(playerId: string, itemId: string, price: number, currency?: string): void;
/**
 * Track purchase completed (convenience function).
 */
export declare function trackPurchaseCompleted(playerId: string, itemId: string, price: number, currency?: string, transactionId?: string): void;
/**
 * Track conversation sent (convenience function).
 */
export declare function trackConversationSent(playerId: string, npcId: string, messageType: string): void;
/**
 * Track level up (convenience function).
 */
export declare function trackLevelUp(playerId: string, newLevel: number, category?: string): void;
/**
 * Track tutorial step (convenience function).
 */
export declare function trackTutorialStep(playerId: string, stepName: string, completed?: boolean): void;
/**
 * Track relationship milestone (convenience function).
 */
export declare function trackRelationshipMilestone(playerId: string, npcId: string, relationshipType: string, affinityLevel: number): void;
/**
 * Track death (convenience function).
 */
export declare function trackDeath(playerId: string, age: number, cause: string): void;
//# sourceMappingURL=analytics_manager.d.ts.map