package cn.axzo.msg.center.nimpush;

import cn.axzo.msg.center.domain.entity.MessageTemplateV3;
import cn.axzo.msg.center.service.enums.MessageChannel;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

import java.util.List;

/**
 * @author yanglin
 */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class PushPriorityController {

    private final MessageTemplateV3 template;

    public static PushPriorityController create(MessageTemplateV3 template) {
        return new PushPriorityController(template);
    }

    public boolean isPushViaTodo() {
        List<MessageChannel> channels = template.determineChannels();
        return channels.size() == 1 && channels.contains(MessageChannel.TODO);
    }

    public boolean isPushViaIm() {
        List<MessageChannel> channels = template.determineChannels();
        return channels.contains(MessageChannel.IM);
    }

}