package com.keao.edu.common.entity;

import org.springframework.http.HttpStatus;

/**
 * HttpResponse 返回结果
 */
public class HttpResponseResult<T> {

	private boolean status = true;
	private String msg;
	private T data;
	private int code;

	public HttpResponseResult(boolean status, int code, T data, String message) {
		this.status = status;
		this.msg = message;
		this.data = data;
		this.code = code;
	}

	public HttpResponseResult(boolean status, HttpStatus resultCode, T data, String message) {
		this.status = status;
		this.msg = message;
		this.data = data;
		this.code = resultCode.value();
	}

	public HttpResponseResult() {
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public boolean getStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public void success() {
		this.status = true;
	}

	public void fail() {
		this.status = false;
	}

}
