package com.bjtdba.userCenter.dto.request;

import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Positive;

@Getter
@Setter
public class GetUserListRequest {
    @Valid
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "账号格式错误")
    private String account;

    private String nickname;

    @Valid
    @Positive(message = "用户ID必须为正数")
    private Long uid;

    @Valid
    @Positive(message = "状态值必须为正数")
    private Integer status;

    @Valid
    @Positive(message = "页码必须为正数")
    private Integer pageNum = 1;

    @Valid
    @Positive(message = "每页数量必须为正数")
    private Integer pageSize = 10;

    // 分页偏移量计算
    public int getOffset() {
        return (pageNum - 1) * pageSize;
    }

}
