import { Logger } from '../../../lib/logger'

export class TransactionLogger {
  static log(mode: 'CORE' | 'SNAP', event: string, data: any) {
    Logger.info(`[${mode}] ${event}`, {
      ...data,
      mode,
      timestamp: new Date().toISOString()
    })
  }

  static logPaymentInit(mode: 'CORE' | 'SNAP', orderId: string, amount: number) {
    this.log(mode, 'payment.init', { orderId, amount })
  }

  static logPaymentSuccess(mode: 'CORE' | 'SNAP', orderId: string, transactionId: string) {
    this.log(mode, 'payment.success', { orderId, transactionId })
  }

  static logPaymentError(mode: 'CORE' | 'SNAP', orderId: string, error: any) {
    this.log(mode, 'payment.error', { orderId, error: error.message })
  }

  static logWebhookReceived(mode: 'CORE' | 'SNAP', orderId: string, status: string) {
    this.log(mode, 'webhook.received', { orderId, status })
  }

  static logWebhookProcessed(mode: 'CORE' | 'SNAP', orderId: string, internalStatus: string) {
    this.log(mode, 'webhook.processed', { orderId, internalStatus })
  }
}