import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsIn, IsInt, IsOptional, Max, Min } from 'class-validator';

export class GetPriceMoversDto {
  @ApiProperty({
    description: 'Price movement direction',
    enum: ['up', 'down'],
    example: 'up',
  })
  @IsIn(['up', 'down'])
  direction: 'up' | 'down' = 'up';

  @ApiPropertyOptional({
    description: 'Look-back period',
    enum: ['7d', '14d', '30d'],
    default: '7d',
    example: '7d',
  })
  @IsOptional()
  @IsIn(['7d', '14d', '30d'])
  period: string = '7d';

  @ApiPropertyOptional({
    description: 'Maximum number of results to return',
    minimum: 1,
    maximum: 20,
    default: 5,
    example: 5,
  })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(20)
  limit: number = 5;

  @ApiPropertyOptional({
    description: 'Geographic aggregation level (currently only "district" is supported)',
    enum: ['district'],
    default: 'district',
    example: 'district',
  })
  @IsOptional()
  @IsIn(['district'])
  level: 'district' = 'district';
}
