/**
 * ShareUsed Event
 *
 * Emitted when a share is used in a signing operation.
 */

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

export class ShareUsedEvent extends DomainEvent {
  constructor(
    public readonly shareId: string,
    public readonly sessionId: string,
    public readonly messageHash: string,
  ) {
    super();
  }

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

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

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

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