/**
 * SessionTimeout Event
 *
 * Emitted when a session times out.
 */

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

export class SessionTimeoutEvent extends DomainEvent {
  constructor(
    public readonly sessionId: string,
    public readonly partyId: string,
    public readonly sessionType: SessionType,
    public readonly lastRound: number,
  ) {
    super();
  }

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

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

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

  get payload(): Record<string, unknown> {
    return {
      sessionId: this.sessionId,
      partyId: this.partyId,
      sessionType: this.sessionType,
      lastRound: this.lastRound,
    };
  }
}
