package com.tax.token.model;

import com.yxcheng.token.utils.StringUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public class TkToken {

    private Integer id;

    private String taxno;

    private String token;

    private String tokenStatus;

    private Date reqDate;

    private Date resDate;

    private String keyCode;

    private String secert;

    private String zoneCode;

    private String userCode;

    private String serverNo;

    private Integer times;

    private String isValid;

    private String ipServerNo;

    private String tokenMessage;

    private String tokenCode;

    private String userType;

    private String tokenErrorMessage;

    private String tokenErrorCode;

    private Date tokenErrorDate;

    private String secretMd5;

    private String requestFrom;

    private String errorCode;

    private String errorMessage;

    private String zoneFlag = "0";

    private String loginType;

    private String functionNo;

    private Date retryTime;

    private String retrySecond;

    private Date createDate;

    private Date updateDate;

    private boolean jsonFlag = false;
    private String taxUserInfo;

    private String proxyIp;

    private String taxLoginName;

    private String requestId;

    private String updateErrorFlag;

    private String resContext;

    private String checkType;

    private String site;

    private String target;

    private String authCode;

    private String loginTaxno;

    @Override
    public String toString() {
        return "TkToken{" +
                "taxno='" + taxno + '\'' +
                ", zoneCode='" + zoneCode + '\'' +
                ", token='" + token + '\'' +
                ", tokenStatus='" + tokenStatus + '\'' +
                ", tokenMessage='" + tokenMessage + '\'' +
                ", tokenCode='" + tokenCode + '\'' +
                ", userType='" + userType + '\'' +
                ", requestFrom='" + requestFrom + '\'' +
                ", isValid='" + isValid + '\'' +
                ", errorCode='" + errorCode + '\'' +
                ", errorMessage='" + errorMessage + '\'' +
                '}';
    }

    public String parseTaxUserInfo() {
        if(StringUtil.isNotEmpty(getSecert()) && StringUtil.isJSON(getSecert())) {
            taxUserInfo = getSecert();
        }
        return taxUserInfo;
    }

    public String printSaveInfo() {
        return getTaxno() + ",userCode:" + getUserCode()  + ",secert:" + getSecert() + ",userType:" + getUserType() + ",jsonFlag:" + isJsonFlag() + ",isValid:" + getIsValid();
    }
}