package com.ym.mec.biz.event.source;

import com.ym.mec.biz.dal.enums.MessageTypeEnum;
import com.ym.mec.biz.event.SendMessageChangeEvent;
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

@Component
public class SendMessageSource {
    @Resource
    private ApplicationContext applicationContext;

    public void batchSendMessage(MessageSenderPluginContext.MessageSender messageSender,
                                 MessageTypeEnum msgTemplate,
                                 Map<Integer, String> receivers,
                                 String url,
                                 String pushType,
                                 Object... args){
        applicationContext.publishEvent(new SendMessageChangeEvent(this,messageSender,msgTemplate,receivers,url,pushType,args));
    }
}
