package com.jkcredit.invoice.hub.spi.rest.data;

import com.jkcredit.invoice.hub.util.CommonUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description:
 * @author: xusonglin
 * @create: 2020/1/15 22:02
 * @version: V1.0
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ApiResponseData {
    public static Integer SUCCESS = 1;
    public static Integer FAILED = 3;

    private Integer data;
    private Integer code;
    private String requestid;
    private String msg;

    public static ApiResponseData success(Integer code, String msg) {
        return new ApiResponseData(SUCCESS, code, CommonUtil.getRequestId(), msg);
    }

    public static ApiResponseData failure(Integer code, String msg) {
        return new ApiResponseData(FAILED, code, CommonUtil.getRequestId(), msg);
    }
}
