package com.njcn.msgpush.module.push.client.factory.impl;

import com.njcn.msgpush.module.push.client.factory.MessageProviderFactory;
import com.njcn.msgpush.module.push.client.sender.AppPushSender;
import com.njcn.msgpush.module.push.client.sender.EmailSender;
import com.njcn.msgpush.module.push.client.sender.Sender;
import com.njcn.msgpush.module.push.client.sender.SmsSender;
import com.njcn.msgpush.module.push.client.sender.impl.TelecomSmsSender;
import com.njcn.msgpush.module.push.client.setting.impl.TelecomSmsSetting;
import com.njcn.msgpush.module.push.dal.dataobject.channel.ChannelProviderConfigDO;
import lombok.extern.slf4j.Slf4j;

/**
 * @author caozehui
 * @data 2026-02-11
 */
@Slf4j
public class TelecomProviderFactory implements MessageProviderFactory {

    @Override
    public SmsSender createSmsSender(ChannelProviderConfigDO config, Sender sender) {
        TelecomSmsSetting telecomSmsSetting = TelecomSmsSetting.builder()
                .account(config.getAppKey())
                .password(config.getAppSecret())
                .apiUrl(config.getApiUrl())
                .extno(config.getExtno())
                .build();

        return new TelecomSmsSender(telecomSmsSetting, sender);
    }

    @Override
    public EmailSender createEmailSender(ChannelProviderConfigDO config, Sender sender) {
        log.error("电信暂不支持email推送");
        return null;
    }

    @Override
    public AppPushSender createAppPushSender(ChannelProviderConfigDO config, Sender sender) {
        log.error("电信暂不支持app推送");
        return null;
    }
}
