import { SmsLog } from '../entities/sms-log.entity';
import { SmsVerificationType } from '../entities/sms-verification.entity';
import { SmsDeliveryStatus } from '../entities/sms-log.entity';

export interface ISmsLogRepository {
  /** 记录发送日志 */
  create(data: {
    phone: string;
    type: SmsVerificationType;
    status: SmsDeliveryStatus;
    provider?: string;
    providerId?: string;
    errorMsg?: string;
    userId?: string;
  }): Promise<SmsLog>;

  /** 按手机号查询日志 */
  findByPhone(
    phone: string,
    options?: { limit?: number; offset?: number },
  ): Promise<SmsLog[]>;

  /** 更新发送状态 */
  updateStatus(
    id: string,
    status: SmsDeliveryStatus,
    providerId?: string,
    errorMsg?: string,
  ): Promise<void>;
}

export const SMS_LOG_REPOSITORY = Symbol('ISmsLogRepository');
