import { ApiProperty } from '@nestjs/swagger';

/**
 * 分页信息
 */
export class PageInfoEntity {
  constructor({ current, size }) {
    this.size = +size || 10;
    this.current = +current || 1;
    this.start = (this.current - 1) * this.size;
  }

  /**
   * 当前页
   */
  @ApiProperty({ description: '当前页' })
  current: number;

  /**
   * 每页条数
   */
  @ApiProperty({ description: '每页条数' })
  size: number;

  /**
   * 起始页
   */
  @ApiProperty({ description: '起始页' })
  start: number;
}
