package com.red.circle.other.inner.model.cmd.user;

import com.red.circle.framework.core.dto.PageCommand;
import java.io.Serial;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 用户资料列表查询.
 *
 * @author pengliang on 2022/2/21
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class UserBaseInfoPageQryCmd extends PageCommand {

  @Serial
  private static final long serialVersionUID = 1L;

  /**
   * 用户id集合.
   */
  private List<Long> userIds;

  /**
   * 来源系统
   */
  private List<String> sysOrigins;

  /**
   * 性别
   */
  private Integer userSex;

  /**
   * 用户类型
   */
  private Integer userType;

  /**
   * 认证类型
   */
  private String authType;

  /**
   * 注册时间
   */
  private Timestamp startCreateDate;

  /**
   * 结束时间
   */
  private Timestamp endCreateDate;

  /**
   * 来源平台
   */
  private String originPlatform;

  /**
   * 是否已注销
   */
  private Integer del;

  /**
   * 设备ID
   */
  private String deviceId;

  /**
   * 国家code.
   */
  private String countryCode;

  /**
   * 分页数.
   */
  private Integer pageIndex;

  /**
   * 分页数.
   */
  private Integer pageSize;

  public int getPageIndex() {
    this.pageSize = Objects.isNull(this.pageSize) || this.pageSize < 1 ? 1 : this.pageSize;
    return Objects.isNull(this.pageIndex) || this.pageIndex < 1
        ? 0
        : (this.pageIndex - 1) * this.pageSize;
  }

}
