package me.zhengjie.base;

import lombok.Data;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import java.io.Serializable;
import java.util.List;

public class BaseResponse<T>  implements Serializable {

    private int status;
    private String message;
    private T data;
    private Long timestamp;

    public BaseResponse(T data) {
        this.setStatus(200);
        this.setData(data);
        this.setMessage("sucess");
        this.setTimestamp(System.currentTimeMillis());
    }

    public BaseResponse(T data, int code) {
        this.setStatus(code);
        this.setData(data);
        this.setMessage("sucess");
        this.setTimestamp(System.currentTimeMillis());
    }

    public BaseResponse(T data, int code,String message) {
        this.setStatus(code);
        this.setData(data);
        this.setMessage(message);
        this.setTimestamp(System.currentTimeMillis());
    }

    public int getStatus() {
        return status;
    }

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

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

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

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }
}
