import { DomainEvent } from './domain-event.base';
import { RightType } from '../value-objects/right-type.enum';
import { RewardStatus } from '../value-objects/reward-status.enum';

export interface RewardCreatedPayload {
  entryId: string;
  userId: string;
  sourceOrderNo: string;
  sourceUserId: string;
  rightType: RightType;
  usdtAmount: number;
  hashpowerAmount: number;
  rewardStatus: RewardStatus;
  expireAt: Date | null;
}

export class RewardCreatedEvent extends DomainEvent {
  constructor(private readonly payload: RewardCreatedPayload) {
    super();
  }

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

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

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

  toPayload(): RewardCreatedPayload {
    return { ...this.payload };
  }
}
