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

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

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@ApiModel("分页参数")
public class BpmPageParam implements Serializable {
    private static final Integer PAGE_NO = 1;
    private static final Integer PAGE_SIZE = 10;
    @ApiModelProperty(value = "页码，从 1 开始", required = true, example = "1")
    @NotNull(message = "页码不能为空")
    @Min(value = 1L, message = "页码最小值为 1")
    private Integer pageNo;
    @ApiModelProperty(value = "每页条数，最大值为 9999", required = true, example = "10")
    @NotNull(message = "每页条数不能为空")
    @Min(value = 1L, message = "页码最小值为 1")
    @Max(value = 9999L, message = "页码最大值为 9999")
    private Integer pageSize;

    public BpmPageParam() {
        this.pageNo = PAGE_NO;
        this.pageSize = PAGE_SIZE;
    }

    public Integer getPageNo() {
        return this.pageNo;
    }

    public Integer getPageSize() {
        return this.pageSize;
    }

    public BpmPageParam setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
        return this;
    }

    public BpmPageParam setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof BpmPageParam)) {
            return false;
        } else {
            BpmPageParam other = (BpmPageParam) o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$pageNo = this.getPageNo();
                Object other$pageNo = other.getPageNo();
                if (this$pageNo == null) {
                    if (other$pageNo != null) {
                        return false;
                    }
                } else if (!this$pageNo.equals(other$pageNo)) {
                    return false;
                }

                Object this$pageSize = this.getPageSize();
                Object other$pageSize = other.getPageSize();
                if (this$pageSize == null) {
                    if (other$pageSize != null) {
                        return false;
                    }
                } else if (!this$pageSize.equals(other$pageSize)) {
                    return false;
                }

                return true;
            }
        }
    }

    @Override
    public String toString() {
        return "PageParam(pageNo=" + this.getPageNo() + ", pageSize=" + this.getPageSize() + ")";
    }

    protected boolean canEqual(Object other) {
        return other instanceof BpmPageParam;
    }

}
