package org.springblade.thirdparty.mk.pojo.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

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

/**
 * @author bfhuange
 * @since 2025/2/24
 */
@NoArgsConstructor
@Data
public class MKPageVO<T> implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     *  分页位移量
     */
    private Integer offset;
    /**
     *  每页数目
     */
    private Integer pageSize;
    /**
     *  总数
     */
    private Integer totalSize;
    /**
     *  返回内容
     */
    private List<T> content;

    public MKPageVO(Integer totalSize) {
        this.totalSize = totalSize;
        this.content = Collections.emptyList();
    }

    /**
     *  空的结果
     * @return
     * @param <T>
     */
    public static <T> MKPageVO<T> empty() {
        return new MKPageVO<>(0);
    }
}
