/**
 * ShareDecryptionAttempted Event
 *
 * Emitted when share decryption is attempted.
 */

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

export class ShareDecryptionAttemptedEvent extends DomainEvent {
  constructor(
    public readonly shareId: string,
    public readonly success: boolean,
    public readonly reason?: string,
  ) {
    super();
  }

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

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

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

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