package com.uas.eis.sdk.resp;

import com.uas.eis.sdk.entity.ApiResult;


/**
 * @author
 * @email
 * @date 2021-12-22 20:00
 */
public class ApiResponse {

    private final static String SUCCESS = "success";

    public static <T> ApiResult<T> successRsp(String requestId) {
        return new ApiResult<T>().setRequestId(requestId);
    }

    public static <T> ApiResult<T> successRsp(String code, String msg) {
        return new ApiResult<T>().setCode(code).setMessage(msg);
    }

    public static <T> ApiResult<T> successRsp(String code,String requestId, String msg) {
        return new ApiResult<T>().setCode(code).setRequestId(requestId).setMessage(msg);
    }

    public static <T> ApiResult<T> successRsp(String code,String requestId,T data) {
        return new ApiResult<T>().setRequestId(requestId).setData(data).setCode(code);
    }

    public static <T> ApiResult<T> successRsp(String code, String msg,String requestId,T data) {
        return new ApiResult<T>().setCode(code).setMessage(msg).setRequestId(requestId).setData(data);
    }

    public static <T> ApiResult<T> successRsp(String requestId,T data) {
        return successRsp("0",SUCCESS,requestId,data);
    }

    public static <T> ApiResult<T> successRsp(T data) {
        return successRsp("0",SUCCESS,data);
    }

    public static <T> ApiResult<T> failRsp(String code, String msg) {
        return new ApiResult<T>().setCode(code).setMessage(msg);
    }

    public static <T> ApiResult<T> failRsp(String code,String requestId, String msg) {
        return new ApiResult<T>().setCode(code).setMessage(msg).setRequestId(requestId);
    }

    public static <T> ApiResult<T> failRsp(String code, String msg, T data) {
        return new ApiResult<T>().setCode(code).setMessage(msg).setData(data);
    }
    public static <T> ApiResult<T> failRsp(String requestId,T data) {
        return new ApiResult<T>().setRequestId(requestId).setData(data);
    }

    public static <T> ApiResult<T> failRsp(String code, String msg,String requestId,T data) {
        return new ApiResult<T>().setCode(code).setMessage(msg).setRequestId(requestId).setData(data);
    }
}
