import { IsOptional, IsDateString, IsEnum } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';

export enum FoodOrderReportSortBy {
  Count = 'count',
  Price = 'price',
}

export class FoodOrderReportDto {
  @ApiPropertyOptional({
    format: 'date-time',
    description: 'Filter orders from this date and time',
    example: '2024-01-01T08:00:00.000Z',
  })
  @IsOptional()
  @IsDateString()
  from?: string;

  @ApiPropertyOptional({
    format: 'date-time',
    description: 'Filter orders until this date and time',
    example: '2024-12-31T23:59:59.000Z',
  })
  @IsOptional()
  @IsDateString()
  to?: string;

  @ApiPropertyOptional({
    enum: FoodOrderReportSortBy,
    default: FoodOrderReportSortBy.Count,
    description: 'Sort results by order count or food price',
  })
  @IsOptional()
  @IsEnum(FoodOrderReportSortBy)
  sortBy: FoodOrderReportSortBy = FoodOrderReportSortBy.Count;
}
