package com.zanxiang.game.module.manage.pojo.dto;

import lombok.Data;

import java.util.Objects;

/**
 * @author : lingfeng
 * @time : 2023-11-29
 * @description : 客服接口返回
 */
@Data
public class KfMsgResultDTO {

    /**
     * 请求成功
     */
    public static final Long SUCCESS = 0L;

    /**
     * 鉴权失败, token, cookie过期
     */
    public static final Long EXPIRE = 30000L;

    /**
     * 接口结果
     */
    private BaseRespBean base_resp;

    @Data
    public static class BaseRespBean {

        /**
         * 异常消息
         */
        private String err_msg;

        /**
         * 状态code
         */
        private Long ret;
    }

    public Boolean isSueecss() {
        if (this.base_resp == null) {
            return Boolean.FALSE;
        }
        return Objects.equals(this.base_resp.getRet(), KfMsgResultDTO.SUCCESS);
    }

    public Boolean isExpire() {
        if (this.base_resp == null) {
            return Boolean.FALSE;
        }
        return Objects.equals(this.base_resp.getRet(), KfMsgResultDTO.EXPIRE);
    }
}
