import { Injectable } from '@nestjs/common';
import { OnEvent } from '@nestjs/event-emitter';

@Injectable()
export class DealEvents {
  @OnEvent('crm.deal.won')
  async onDealWon(_payload: { clubId: string | null; deal: any }): Promise<void> {
    // For platform deals (clubId=null): could trigger provisioning
    // For club deals: could trigger membership creation
    // Future: integrate with ProvisioningService
  }

  @OnEvent('crm.deal.lost')
  async onDealLost(_payload: { clubId: string | null; deal: any }): Promise<void> {
    // Analytics tracking, lost reason aggregation
  }

  @OnEvent('crm.deal.created')
  async onDealCreated(_payload: { clubId: string | null; deal: any }): Promise<void> {
    // Future: push notification to assignee
  }
}
