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

const OVERVIEW_RANGES = ['7d', '30d', '90d'] as const;

export type OverviewRangeQuery = (typeof OVERVIEW_RANGES)[number];

export class OverviewQueryDto {
  @ApiPropertyOptional({
    enum: OVERVIEW_RANGES,
    default: '30d',
    description: 'Time range for trend charts',
  })
  @IsOptional()
  @IsIn(OVERVIEW_RANGES)
  range?: OverviewRangeQuery = '30d';
}
