package com.jeequan.jeepay.thirdparty.channel.flpay.model;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * TODO
 * 福禄通用返回参数封装
 * @author crystal
 * @date 2024/3/25 13:51
 */
@Data
@NoArgsConstructor
public class RespEntity {

    public static final int SUCCESS_CODE = 0;

    public static final int SUCCESS_EXT_CODE = 1;

    public static final int NETWORK_ERROR_CODE = 500;

    private int code;

    private String data;

    private String msg;

    private String subCode;

    private String subMsg;

    public RespEntity(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static RespEntity fail(String msg) {
        RespEntity result = new RespEntity(NETWORK_ERROR_CODE,msg);
        return result;
    }

    /**
     * 判断是否返回成功
     */
    public boolean isSuccess(){
        return SUCCESS_CODE == this.code;
    }
}
