import { ApiProperty } from '@nestjs/swagger';

export enum TimelineEventType {
  CREATED = 'CREATED',
  SUBMITTED = 'SUBMITTED',
  STATUS_CHANGED = 'STATUS_CHANGED',
  DOCUMENT_ADDED = 'DOCUMENT_ADDED',
  DOCUMENT_UPDATED = 'DOCUMENT_UPDATED',
  APPROVAL_REQUESTED = 'APPROVAL_REQUESTED',
  APPROVAL_GRANTED = 'APPROVAL_GRANTED',
  APPROVAL_REJECTED = 'APPROVAL_REJECTED',
  APPROVAL_INVALIDATED = 'APPROVAL_INVALIDATED',
  COMMENTS_ADDED = 'COMMENTS_ADDED',
  CANCELLED = 'CANCELLED',
}

export class TimelineEventDto {
  @ApiProperty({
    description: 'Event ID (UUID)',
  })
  id: string;

  @ApiProperty({
    description: 'Request ID',
  })
  requestId: string;

  @ApiProperty({
    description: 'Type of timeline event',
    enum: TimelineEventType,
  })
  eventType: TimelineEventType;

  @ApiProperty({
    description: 'Event description',
  })
  description: string;

  @ApiProperty({
    description: 'Actor/user who triggered the event',
    nullable: true,
  })
  actor: string | null;

  @ApiProperty({
    description: 'Additional event metadata',
    type: Object,
  })
  metadata: Record<string, any>;

  @ApiProperty({
    description: 'Event timestamp',
  })
  timestamp: Date;

  @ApiProperty({
    description: 'Blockchain transaction hash',
    nullable: true,
  })
  blockchainTxHash: string | null;
}
