package com.gic.haoban.manage.web.qo.chat;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author shangfeng
 * @date 2024-06-20 10:44:55
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class SingleChatDetailReq extends ChatBaseReq implements Serializable {
    private static final long serialVersionUID = -1939493530776069432L;

    /**
     * 用户模糊
     */
    private String vagueQueryUser;

    /**
     * 导购名称/code
     */
    private String vagueQueryClerk;


    /**
     * 发送人类型 1导购2客户
     */
    private String sendType;

    /**
     * 消息类型 1文本2图片3视频4小程序
     */
    private Integer msgType;

    /**
     * 会话内容
     */
    private String content;

    /**
     * 下载导出参数：为了兼容前端传参
     */
    private String requestProject;

    /**
     * 获取排序
     * * *
     * @return
     */
    public Integer getDataApiOrderField() {
        Map<String, Integer> map = new HashMap<>(4);
        map.put("sendTime", 1);
        return map.get(getOrderByFields()) == null ? 1 : map.get(getOrderByFields());
    }

    /**
     * 处理请求参数
     * * *
     * @param jsonObject
     */
    public void dealWithParam(JSONObject jsonObject) {
        super.dealWithParam(jsonObject);
        if (getOrderByFields() != null) {
            jsonObject.put("orderByFields", getDataApiOrderField());
        }
        if (StringUtils.isNotBlank(vagueQueryClerk)) {
            jsonObject.put("vagueQueryClerk", vagueQueryClerk);
        }
        if (StringUtils.isNotBlank(content)) {
            jsonObject.put("content", content);
        }
        if (StringUtils.isNotBlank(vagueQueryUser)) {
            jsonObject.put("vagueQueryUser", vagueQueryUser);
            jsonObject.put("phoneNum", vagueQueryUser);
        }
        if (sendType != null) {
            jsonObject.put("sendType", sendType);
        }
        if (msgType != null) {
            jsonObject.put("msgType", msgType);
        }

    }

    public String getVagueQueryUser() {
        return vagueQueryUser;
    }

    public void setVagueQueryUser(String vagueQueryUser) {
        this.vagueQueryUser = vagueQueryUser;
    }

    public String getVagueQueryClerk() {
        return vagueQueryClerk;
    }

    public void setVagueQueryClerk(String vagueQueryClerk) {
        this.vagueQueryClerk = vagueQueryClerk;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getRequestProject() {
        return requestProject;
    }

    public void setRequestProject(String requestProject) {
        this.requestProject = requestProject;
    }

    public String getSendType() {
        return sendType;
    }

    public void setSendType(String sendType) {
        this.sendType = sendType;
    }

    public Integer getMsgType() {
        return msgType;
    }

    public void setMsgType(Integer msgType) {
        this.msgType = msgType;
    }
}
