package com.nokia.domainb.capability;

import java.util.HashMap;
import java.util.Map;

import cn.chinaunicom.open.common.Const;
import cn.chinaunicom.open.nlgxptconnection.COMPConnection;
import cn.chinaunicom.open.nlgxptconnection.COMPConnectionContext;
import cn.chinaunicom.open.nlgxptconnection.impl.COMPJsonConnection;

/*
 * 短信用户投诉分析查询接口
 * json_chinaUnicom_hb18_complaintManagement_usercomplaintQuerys
 */
public class UsercomplaintQuerys extends AbstractQuery {
    // TODO 正式上线后才能获取到正式环境url
    private static final String url = "";
    private static final String urlTest = "http://10.124.150.230:8000/api/chinaUnicom/hb18/complaintManagement/usercomplaintQuerys/v1";

    public COMPConnectionContext query(String mobile, String destAddr, String complaintType, String isMobile,
            String flowNo, String beginTime, String endTime, String token, boolean test) {
        String realAppSecret = test ? appSecretTest : appSecret;
        String realUrl = test ? urlTest : url;
        COMPConnection compConnection = new COMPJsonConnection(appId, realAppSecret);

        // REQ
        Map<String, Object> req = new HashMap<>();

        Map<String, Object> userComplaintQuerysReq = new HashMap<>();
        req.put("USERCOMPLAINT_QUERYS_REQ", userComplaintQuerysReq);

        userComplaintQuerysReq.put("mobile", mobile);
        userComplaintQuerysReq.put("destAddr", destAddr);
        userComplaintQuerysReq.put("complaintType", complaintType);
        userComplaintQuerysReq.put("isMobile", isMobile);
        userComplaintQuerysReq.put("flowNo", flowNo);
        userComplaintQuerysReq.put("beginTime", beginTime);
        userComplaintQuerysReq.put("endTime", endTime);
        userComplaintQuerysReq.put("token", token);

        return compConnection.excute(Const.HttpMethodType.POST, realUrl, req, false);
    }
}
