import { IsString, IsNotEmpty, IsOptional, IsInt, MaxLength } from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CheckCodeQueryDto {
  @IsString()
  @IsNotEmpty()
  @MaxLength(50)
  @ApiProperty({ example: 'HDB_2026', description: 'Program code to check for availability (max 50 characters)' })
  code: string;

  @IsOptional()
  @IsInt()
  @Type(() => Number)
  @ApiPropertyOptional({ description: 'Exclude this program ID from the check (use during update flows)' })
  excludeId?: number;
}
