package org.springblade.openapi.ocr.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 *  分页查询参数
 * @author bfhuange
 * @since 2025/4/22
 */
@Data
@Schema(description = "分页查询参数")
public class PageQuery implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     *  每页最大数量 200
     */
    public static final int MAX_SIZE = 200;
    /**
     * 当前页
     */
    @Schema(description = "当前页，默认1")
    protected Integer current = 1;

    /**
     * 每页的数量
     */
    @Schema(description = "每页的数量，默认10，超过200会修改为200")
    protected Integer size = 10;

    public void setSize(Integer size) {
        if (size != null && size > MAX_SIZE) {
            size = MAX_SIZE;
        }
        this.size = size;
    }
}
