/**
 * SigningCompleted Event
 *
 * Emitted when a signing session is completed successfully.
 */

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

export class SigningCompletedEvent extends DomainEvent {
  constructor(
    public readonly sessionId: string,
    public readonly partyId: string,
    public readonly messageHash: string,
    public readonly signature: string,
    public readonly publicKey: string,
  ) {
    super();
  }

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

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

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

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