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 15:56:45
 */
public class GroupChatJoinDetailReq extends ChatBaseReq implements Serializable {

    private static final long serialVersionUID = 7925103932910960454L;

    /**
     * 群查询模糊
     */
    private String vagueQueryGroup;

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

    /**
     * 入群方式
     */
    private String joinScene;

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

    /**
     * 获取排序
     * * *
     * @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 (getOrderByFields() != null) {
            jsonObject.put("orderByFields", getDataApiOrderField());
        }
        if (StringUtils.isNotBlank(vagueQueryGroup)) {
            jsonObject.put("vagueQueryGroup", vagueQueryGroup);
        }
        if (StringUtils.isNotBlank(userType)) {
            jsonObject.put("userType", userType);
        }
        if (StringUtils.isNotBlank(joinScene)) {
            jsonObject.put("joinScene", joinScene);
        }
    }

    public String getVagueQueryGroup() {
        return vagueQueryGroup;
    }

    public void setVagueQueryGroup(String vagueQueryGroup) {
        this.vagueQueryGroup = vagueQueryGroup;
    }

    public String getUserType() {
        return userType;
    }

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

    public String getJoinScene() {
        return joinScene;
    }

    public void setJoinScene(String joinScene) {
        this.joinScene = joinScene;
    }

    public String getRequestProject() {
        return requestProject;
    }

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