import { DomainEvent } from './domain-event.base';
import { ReportType } from '../value-objects/report-type.enum';

export interface ReportGeneratedPayload {
  snapshotId: string;
  reportType: ReportType;
  reportCode: string;
  periodKey: string;
  rowCount: number;
  generatedAt: Date;
}

export class ReportGeneratedEvent extends DomainEvent {
  constructor(private readonly payload: ReportGeneratedPayload) {
    super();
  }

  get eventType(): string {
    return 'ReportGenerated';
  }

  get aggregateId(): string {
    return this.payload.snapshotId;
  }

  get aggregateType(): string {
    return 'ReportSnapshot';
  }

  toPayload(): ReportGeneratedPayload {
    return { ...this.payload };
  }
}
