package com.persagy.framework.dto;

public class ApiResult {
	public static final String result_success = "success";
	public static final String result_fail = "fail";
	
	private ApiResult() {
	}
	
	public static ApiResult instance(boolean success) {
		ApiResult ins = new ApiResult();
		if(success) {
			ins.setResult(result_success);
		}else {
			ins.setResult(result_fail);
		}
		return ins;
	}
	
	public static ApiResult instanceError(String message) {
		ApiResult ins = new ApiResult();
		ins.setResult(result_fail);
		ins.setMessage(message);
		return ins;
	}
	
	public static ApiResult instanceSuccess() {
		ApiResult ins = new ApiResult();
		ins.setResult(result_success);
		return ins;
	}
	
	public static ApiResult instanceSuccess(Object data) {
		ApiResult ins = new ApiResult();
		ins.setResult(result_success);
		ins.setData(data);
		return ins;
	}
	
	public static ApiResult getInstance() {
		ApiResult ins = new ApiResult();
		ins.setResult(result_fail);
		return ins;
	}
	
	private String result;
	private String message;
	private Object data;
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	
}
