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_pretreatmentProcess
 */
public class PretreatmentProcess extends AbstractQuery {
    private static final String url = "http://10.245.50.26:8000/api/chinaUnicom/hb18/complaintManagement/pretreatmentProcess/v1";
    private static final String urlTest = "http://10.124.150.230:8000/api/chinaUnicom/hb18/complaintManagement/pretreatmentProcess/v1";

    public COMPConnectionContext query(String phoneNumber, 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> pretreatmentProcessReq = new HashMap<>();
        req.put("PRETREATMENT_PROCESS_REQ", pretreatmentProcessReq);

        pretreatmentProcessReq.put("phone", phoneNumber);

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