package com.casic.missiles.dto;

import com.casic.missiles.model.response.ResponseData;

/**
 * @Description: for return
 * @Author: wangpeng
 * @Date: 2022/11/27 00:56
 */
public class ReturnUtil {
    public ReturnUtil() {
    }

    public static ReturnDTO success() {
        return new ReturnDTO(ResponseData.DEFAULT_SUCCESS_CODE, ResponseData.DEFAULT_SUCCESS_MESSAGE);
    }

    public static ReturnDTO success(Object data) {
        return new ReturnDTO(ResponseData.DEFAULT_SUCCESS_CODE, ResponseData.DEFAULT_SUCCESS_MESSAGE, data);
    }

    public static ReturnDTO success(Integer code, String message) {
        return new ReturnDTO(code, message);
    }

    public static ReturnDTO failed() {
        return new ReturnDTO(ResponseData.DEFAULT_ERROR_CODE, ResponseData.DEFAULT_ERROR_MESSAGE);
    }

    public static ReturnDTO failed(String message) {
        return new ReturnDTO(ResponseData.DEFAULT_ERROR_CODE, message);
    }

    public static ReturnDTO failed(Integer code, String message) {
        return new ReturnDTO(code, message);
    }

}
