import { ApiExtraModels, ApiProperty } from "@nestjs/swagger";
import { IsArray } from "class-validator";
import { Order } from "../enums";

/**
 * List of allowed properties in this DTO
 */
const allowedProperties = ['total', 'pagenum', 'order', 'hasNext', 'hasPrev', 'pagesize'];

/**
 * Page model for pagination
 */
@ApiExtraModels()
export class PageMetaDto {
    /**
     * Total number of hits (results) acquired from the search
     */
    @IsArray()
    @ApiProperty({
        description: 'Total number of hits (results) acquired from the search',
        example: 314
    })
    total: number;

    /**
     * Order of the elements on the page
     */
    @ApiProperty({
        description: 'Order of the elements on the page',
        example: Order.DESC
    })
    order: Order;
}