/**
 * KeygenCompleted Event
 *
 * Emitted when a keygen session is completed successfully.
 */

import { DomainEvent } from './domain-event.base';

export class KeygenCompletedEvent extends DomainEvent {
  constructor(
    public readonly sessionId: string,
    public readonly partyId: string,
    public readonly publicKey: string,
    public readonly shareId: string,
    public readonly threshold: string,
  ) {
    super();
  }

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

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

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

  get payload(): Record<string, unknown> {
    return {
      sessionId: this.sessionId,
      partyId: this.partyId,
      publicKey: this.publicKey,
      shareId: this.shareId,
      threshold: this.threshold,
    };
  }
}
