import { Injectable, Logger } from '@nestjs/common';
import { SmsVerificationType } from '../../domain/entities/sms-verification.entity';
import { ISmsProvider, SmsDeliveryResult } from './sms-provider.interface';

/**
 * 开发模式 SMS Provider — 将验证码打印到控制台
 */
@Injectable()
export class ConsoleSmsProvider implements ISmsProvider {
  private readonly logger = new Logger('ConsoleSmsProvider');

  async send(
    phone: string,
    code: string,
    type: SmsVerificationType,
  ): Promise<SmsDeliveryResult> {
    this.logger.warn(
      `[DEV SMS] phone=${phone} code=${code} type=${type}`,
    );
    return { success: true, providerId: `console-${Date.now()}` };
  }
}
