package cn.axzo.workflow.common.model.response;

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

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

/**
 * @author shao_hua
 */
@ApiModel("分页结果")
public class BpmPageResult<T> implements Serializable {
    @ApiModelProperty(
            value = "数据",
            required = true
    )
    private List<T> list;
    @ApiModelProperty(
            value = "总量",
            required = true
    )
    private Long total;

    public BpmPageResult() {
    }

    public BpmPageResult(List<T> list, Long total) {
        this.list = list;
        this.total = total;
    }

    public BpmPageResult(Long total) {
        this.list = new ArrayList();
        this.total = total;
    }

    public static <T> BpmPageResult<T> empty() {
        return new BpmPageResult(0L);
    }

    public static <T> BpmPageResult<T> empty(Long total) {
        return new BpmPageResult(total);
    }

    public List<T> getList() {
        return this.list;
    }

    public Long getTotal() {
        return this.total;
    }

    public BpmPageResult<T> setList(List<T> list) {
        this.list = list;
        return this;
    }

    public BpmPageResult<T> setTotal(Long total) {
        this.total = total;
        return this;
    }
}
