package cn.axzo.msg.center.nimpush.device;

import java.util.List;

import cn.axzo.epic.client.vo.response.ApkDeviceMaxCodeResp;
import cn.axzo.im.center.common.enums.AppTypeEnum;
import cn.axzo.msg.center.nimpush.PushChannel;
import cn.axzo.msg.center.service.enums.PushTerminalEnum;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

/**
 * @author yanglin
 */
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class PushDevice {

    private final PushDeviceService pushDeviceService;
    private final List<ApkDeviceMaxCodeResp> devices;

    public boolean shouldPush(AppTypeEnum appType,
                              PushChannel pushChannel) {
        PushTerminalEnum pushTerminal = appType == AppTypeEnum.CMP
                ? PushTerminalEnum.B_ENTERPRISE_APP
                : PushTerminalEnum.C_WORKER_APP;
        return shouldPush(pushTerminal, pushChannel);
    }

    public boolean shouldPush(PushTerminalEnum pushTerminal,
                              PushChannel pushChannel) {
        return pushDeviceService.shouldPush(pushTerminal, pushChannel, devices);
    }

}