/**
 * 모니터링 등에서 사용하는 DB 요약 통계.
 */
export function collectBatchSchedulerDatabaseStats(db, logWarn) {
    if (!db) {
        return {};
    }
    try {
        const stats = db
            .prepare(`
        SELECT 
          type,
          COUNT(*) as count,
          COUNT(CASE WHEN pinned = TRUE THEN 1 END) as pinned_count,
          COUNT(CASE WHEN created_at < datetime('now', '-30 days') THEN 1 END) as old_count,
          AVG(importance) as avg_importance
        FROM memory_item 
        GROUP BY type
      `)
            .all();
        const totalMemories = db.prepare('SELECT COUNT(*) as count FROM memory_item').get();
        const dbSize = db.prepare('PRAGMA page_count').get();
        const pageSize = db.prepare('PRAGMA page_size').get();
        return {
            memoryStats: stats,
            totalMemories: totalMemories.count,
            estimatedSize: dbSize.page_count * pageSize.page_size
        };
    }
    catch (error) {
        logWarn('Failed to collect database stats:', error);
        return {};
    }
}
//# sourceMappingURL=batch-scheduler-database-stats.js.map