package com.ms.biz.common;

import com.jinritemai.cloud.base.api.BaseResponse;

public class R<T> {

    public static <T> BaseResponse<Void> ok() {
        return BaseResponse.<Void>builder()
            .success(true)
            .message("success")
            .code("10000")
            .build();
    }

    public static <T> BaseResponse<T> ok(T data) {
        return BaseResponse.<T>builder()
            .success(true)
            .message("success")
            .code("10000")
            .data(data)
            .build();
    }

    public static <T> BaseResponse<T> fail() {
        return fail( "业务异常");
    }

    public static <T> BaseResponse<T> fail(String msg) {
        return fail("100001", msg);
    }

    public static <T> BaseResponse<T> fail(String code, String msg) {
        return BaseResponse.<T>builder()
            .success(false)
            .message(msg)
            .code(code)
            .build();
    }


}
