package com.njcn.msgpush.module.push.client.channel.sms.factory;

import cn.hutool.core.util.StrUtil;
import com.njcn.msgpush.module.push.client.channel.sms.Impl.AliYunSmsClient;
import com.njcn.msgpush.module.push.client.channel.sms.Impl.TelecomSmsClient;
import com.njcn.msgpush.module.push.client.channel.sms.SmsClient;
import com.njcn.msgpush.module.push.client.constant.ClientConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author caozehui
 * @data 2026-02-11
 */
@Component
public class SmsFactory {

    @Autowired
    private AliYunSmsClient aliYunSmsClient;

    @Autowired
    private TelecomSmsClient telecomSmsClient;

    public SmsClient getClient(String smsProviderTypeName) throws RuntimeException {
        if (StrUtil.equals(ClientConstant.ALI_YUN, smsProviderTypeName)) {
            return aliYunSmsClient;
        } else if (StrUtil.equals(ClientConstant.TELECOM, smsProviderTypeName)) {
            return telecomSmsClient;
        } else {
            throw new RuntimeException("暂时不提供" + smsProviderTypeName + "短信服务提供商");
        }
    }
}
