/**
 * PartyJoinedSession Event
 *
 * Emitted when a party joins a session.
 */

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

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

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

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

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

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