import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { ArrayMaxSize, ArrayMinSize, IsArray, IsString } from 'class-validator';

export class AvmCompareQueryDto {
  @ApiProperty({
    description: 'Comma-separated property IDs to compare (2-5)',
    example: 'prop-1,prop-2,prop-3',
    type: String,
  })
  @Transform(({ value }) =>
    typeof value === 'string' ? value.split(',').map((s: string) => s.trim()).filter(Boolean) : value,
  )
  @IsArray()
  @ArrayMinSize(2)
  @ArrayMaxSize(5)
  @IsString({ each: true })
  ids!: string[];
}
