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

export enum DailyOrderReportSortBy {
  Date = 'date',
  TotalAmount = 'totalAmount',
  OrderCount = 'orderCount',
}

export class DailyOrderReportDto {
  @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: DailyOrderReportSortBy,
    default: DailyOrderReportSortBy.Date,
    description: 'Sort results by date, total amount, or order count',
  })
  @IsOptional()
  @IsEnum(DailyOrderReportSortBy)
  sortBy: DailyOrderReportSortBy = DailyOrderReportSortBy.Date;
}
