package cn.axzo.msg.center.nimpush;

import cn.axzo.im.center.common.enums.AppTypeEnum;
import cn.axzo.msg.center.inside.notices.config.push.PushProps.ChannelConfig;
import cn.axzo.msg.center.inside.notices.config.push.PushProps.ChannelIds;
import lombok.Getter;
import lombok.Setter;

/**
 * @author yanglin
 */
@Setter
@Getter
public class PushContent {

    /**
     * 主标题
     */
    private String title;

    /**
     * 推送内容
     */
    private String content;

    /**
     * android点击push的跳转链接
     */
    private String androidPushUrl;

    /**
     * ios点击push的跳转链接
     */
    private String iosPushUrl;

    /**
     * 端信息
     */
    private AppTypeEnum appType;

    /**
     * push消息类型. SYSTEM: 系统消息, OP: 运营消息
     */
    private PushMessageTye messageTye;

    /**
     * 自定义提示音
     */
    private String customSoundFile;

    public String determineAndroidCategory() {
        return messageTye == PushMessageTye.OP
                ? "MARKETING"
                : "IM";
    }

    public String determineChannelId(ChannelConfig channelConfig) {
        ChannelIds channelIds = appType == AppTypeEnum.CM
                ? channelConfig.getWorkerIds()
                : channelConfig.getManagerIds();
        return messageTye == PushMessageTye.OP
                ? channelIds.getOpMessageChannelId()
                : channelIds.getWorkMessageChannelId();
    }
}