package cn.com.countrygarden.bi.main.core;

/**
 * 响应结果生成工具
 */
public class ResultGenerator {
    private static final String DEFAULT_SUCCESS_MESSAGE = "OK";

    public static Result genSuccessResult() {
        return new Result()
                .setResultCode(ResultCode.OK)
                .setResultMsg(DEFAULT_SUCCESS_MESSAGE);
    }

    public static Result genSuccessResult(Object data) {
        return new Result()
                .setResultCode(ResultCode.OK)
                .setResultMsg(DEFAULT_SUCCESS_MESSAGE)
                .setData(data);
    }

    public static Result genFailResult(String message) {
        return new Result()
                .setResultCode(ResultCode.NOK)
                .setResultMsg(message);
    }
    public static Result genFailureResult(String message) {
        return new Result()
                .setResultCode(ResultCode.FAIL)
                .setResultMsg(message);
    }
}
