import 'dashboard_kpi.dart';
import 'dashboard_pending_approval.dart';
import 'dashboard_transaction_summary.dart';

/// 대시보드 전체 요약 응답.
class DashboardSummary {
  const DashboardSummary({
    required this.generatedAt,
    required this.kpis,
    required this.recentTransactions,
    required this.pendingApprovals,
  });

  /// 요약 데이터 생성 시각.
  final DateTime? generatedAt;

  /// KPI 카드 목록.
  final List<DashboardKpi> kpis;

  /// 최근 트랜잭션 목록.
  final List<DashboardTransactionSummary> recentTransactions;

  /// 결재 대기 목록.
  final List<DashboardPendingApproval> pendingApprovals;

  /// KPI를 키로 찾는다.
  DashboardKpi? findKpi(String key) {
    for (final kpi in kpis) {
      if (kpi.key == key) {
        return kpi;
      }
    }
    return null;
  }
}
