/**
 * Admin API Models
 * Models for admin dashboard and monitoring
 */

export interface AdminStatsDto {
  totalRequests: number;
  totalApprovals: number;
  totalDocuments: number;
  totalDepartments: number;
  totalApplicants: number;
  totalBlockchainTransactions: number;
  averageProcessingTime: number;
  requestsByStatus: RequestStatusCount[];
  requestsByType: RequestTypeCount[];
  departmentStats: DepartmentStatsCount[];
  lastUpdated: string;
}

export interface RequestStatusCount {
  status: string;
  count: number;
}

export interface RequestTypeCount {
  type: string;
  count: number;
}

export interface DepartmentStatsCount {
  departmentCode: string;
  departmentName: string;
  approvedCount: number;
  rejectedCount: number;
  pendingCount: number;
}

export interface SystemHealthDto {
  status: 'HEALTHY' | 'DEGRADED' | 'UNHEALTHY';
  database: ServiceHealthDto;
  blockchain: ServiceHealthDto;
  storage: ServiceHealthDto;
  queue: ServiceHealthDto;
  timestamp: string;
}

export interface ServiceHealthDto {
  status: 'UP' | 'DOWN' | 'DEGRADED';
  message?: string;
  responseTime?: number;
}

export interface AuditActivityDto {
  id: string;
  entityType: string;
  entityId: string;
  action: string;
  actorId: string;
  actorType: string;
  changes: Record<string, any>;
  timestamp: string;
}

export interface BlockchainTransactionDto {
  id: string;
  txHash: string;
  type: string;
  status: 'PENDING' | 'CONFIRMED' | 'FAILED';
  gasUsed?: number;
  blockNumber?: number;
  timestamp: string;
  data: Record<string, any>;
}

export interface PaginatedBlockchainTransactionsResponse {
  data: BlockchainTransactionDto[];
  total: number;
  page: number;
  limit: number;
  totalPages: number;
  hasNextPage: boolean;
}

export interface BlockDto {
  blockNumber: number;
  hash: string;
  parentHash: string;
  timestamp: string;
  transactionCount: number;
  gasUsed: number;
  gasLimit: number;
  miner?: string;
  size: number;
}

export interface BlockchainExplorerSummaryDto {
  latestBlockNumber: number;
  totalTransactions: number;
  pendingTransactions: number;
  avgBlockTime: number;
  networkStatus: 'HEALTHY' | 'DEGRADED' | 'DOWN';
  recentBlocks: BlockDto[];
  recentTransactions: BlockchainTransactionDto[];
}
