import { ISync, EntityType } from './CalendarTypes';

/**
 * IAuditEntry - Audit log entry for tracking all entity changes
 *
 * Used for:
 * - Compliance and audit trail
 * - Sync tracking with backend
 * - Change history
 */
export interface IAuditEntry extends ISync {
  /** Unique audit entry ID */
  id: string;

  /** Type of entity that was changed */
  entityType: EntityType;

  /** ID of the entity that was changed */
  entityId: string;

  /** Type of operation performed */
  operation: 'create' | 'update' | 'delete';

  /** User who made the change */
  userId: string;

  /** Timestamp when change was made */
  timestamp: number;

  /** Changes made (full entity for create, diff for update, { id } for delete) */
  changes: unknown;

  /** Whether this audit entry has been synced to backend */
  synced: boolean;
}

/**
 * IAuditLoggedPayload - Event payload when audit entry is logged
 */
export interface IAuditLoggedPayload {
  auditId: string;
  entityType: EntityType;
  entityId: string;
  operation: 'create' | 'update' | 'delete';
  timestamp: number;
}
