/**
 * DTO: LedgerEntryDto
 * 
 * Simplified rating event for ledger display/query.
 * Pragmatic read model - direct repo DTOs, no domain logic.
 */

export interface LedgerEntryDto {
  id: string;
  userId: string;
  dimension: string; // 'driving', 'admin', 'steward', 'trust', 'fairness'
  delta: number; // positive or negative change
  weight?: number;
  occurredAt: string; // ISO date string
  createdAt: string; // ISO date string
  
  source: {
    type: 'race' | 'penalty' | 'vote' | 'adminAction' | 'manualAdjustment';
    id: string;
  };
  
  reason: {
    code: string;
    summary: string;
    details: Record<string, unknown>;
  };
  
  visibility: {
    public: boolean;
    redactedFields: string[];
  };
}

export interface LedgerFilter {
  dimensions?: string[]; // Filter by dimension keys
  sourceTypes?: ('race' | 'penalty' | 'vote' | 'adminAction' | 'manualAdjustment')[];
  from?: string; // ISO date string
  to?: string; // ISO date string
  reasonCodes?: string[];
}

export interface PaginatedLedgerResult {
  entries: LedgerEntryDto[];
  pagination: {
    total: number;
    limit: number;
    offset: number;
    hasMore: boolean;
    nextOffset?: number | null;
  };
}
