import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PropertyType } from '@prisma/client';
import { IsEnum, IsIn, IsOptional, IsString } from 'class-validator';

export class GetMarketHistoryDto {
  @ApiProperty({ description: 'City name', example: 'HCMC' })
  @IsString()
  city!: string;

  @ApiProperty({
    description: 'Look-back period (e.g. 12m, 6m, 24m)',
    example: '12m',
  })
  @IsString()
  period!: string;

  @ApiProperty({
    description: 'Time granularity',
    enum: ['monthly', 'weekly'],
    default: 'monthly',
  })
  @IsIn(['monthly', 'weekly'])
  granularity!: 'monthly' | 'weekly';

  @ApiPropertyOptional({ enum: PropertyType, description: 'Property type filter' })
  @IsOptional()
  @IsEnum(PropertyType)
  propertyType?: PropertyType;
}
