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

import cn.axzo.msg.center.nimpush.PushContent;
import cn.axzo.msg.center.nimpush.PushMessageTye;
import cn.axzo.msg.center.nimpush.payload.intent.UriIntent;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;

/**
 * VIVO
 *
 * @author yanglin
 */
@Component
class VivoPushPayloadBuilder extends AndroidPushPayloadBuilder<UriIntent> {

    @Override
    public UriIntent createIntent() {
        return new UriIntent();
    }

    /**
     * 没找到自定义声音相关的字段
     */
    @Override
    public void build(PushContent content, UriIntent intent, JSONObject payload) {
        JSONObject vivoField = new JSONObject();
        vivoField.put("content", content.getContent());
        vivoField.put("classification",
                content.getMessageTye() == PushMessageTye.OP ? 0 : 1);
        vivoField.put("skipType", 4);
        vivoField.put("networkType", -1);
        vivoField.put("category", content.determineAndroidCategory());
        vivoField.put("skipContent", intent.build());

        payload.put("vivoField", vivoField);
    }

}