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

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;

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

/**
 * @author shangfeng
 * @date 2024-06-20 16:02:41
 */
public class GroupChatChatDetailReq extends ChatBaseReq implements Serializable {

    private static final long serialVersionUID = -6843739232435242253L;


    /**
     * 导购模糊查询
     */
    private String vagueQueryClerk;

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

    /**
     * 用户身份
     */
    private String userType;

    /**
     * 消息类型
     * 1文本2图片3视频4小程序5链接6gif表情7红包8文件9位置10名片11视频电话12语音电话
     */
    private String msgType;

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

    /**
     * 群名称、id
     */
    private String groupSearchParams ;

    /**
     * 聊天内容
     */
    private String content ;

    public String getContent() {
        return content;
    }

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

    public String getGroupSearchParams() {
        return groupSearchParams;
    }

    public void setGroupSearchParams(String groupSearchParams) {
        this.groupSearchParams = groupSearchParams;
    }

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

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

    public String getVagueQueryClerk() {
        return vagueQueryClerk;
    }

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

    public String getVagueQueryUser() {
        return vagueQueryUser;
    }

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

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public String getMsgType() {
        return msgType;
    }

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

    public String getRequestProject() {
        return requestProject;
    }

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