package com.suntray.oa.app.common.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel(value = "统一响应结构")
public class BaseResponse<T> {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "成功标志")
    private boolean success = true;

    @ApiModelProperty(value = "返回处理消息")
    private String message = "";

    @ApiModelProperty(value = "返回代码")
    private Integer code = 0;

    @ApiModelProperty(value = "返回数据对象")
    private T result;

    @ApiModelProperty(value = "时间戳")
    private long timestamp = System.currentTimeMillis();

    public static BaseResponse<String> ok() {
        return ok("操作成功");
    }

    public static BaseResponse<String> ok(String message) {
        BaseResponse<String> response = new BaseResponse<>();

        return response;
    }


}
