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

/**
 * DTO for searching intakes/sessions based on optional filters.
 * Allows filtering by country, institute, or client origin country.
 */
export class SearchIntakesDto {
  /**
   * Optional ID of the visa service country to filter intakes.
   * Example: 9 for a specific country.
   */
  @ApiPropertyOptional({
    description: 'Filter intakes by visa service country ID',
    example: 9,
  })
  @IsOptional()
  @IsNumber({}, { message: 'visa_service_country_id must be a number' })
  visa_service_country_id?: number;

  /**
   * Optional ID of the educational institute to filter intakes.
   * Example: 459 for a specific institute.
   */
  @ApiPropertyOptional({
    description: 'Filter intakes by institute ID',
    example: 459,
  })
  @IsOptional()
  @IsNumber({}, { message: 'institute_id must be a number' })
  institute_id?: number;

  /**
   * Optional ID of the client’s home country to filter intakes.
   * Example: 80 for India, 103 for USA.
   */
  @ApiPropertyOptional({
    description: "Filter intakes by client's home country ID",
    example: 80,
  })
  @IsOptional()
  @IsNumber({}, { message: 'client_from_country_id must be a number' })
  client_from_country_id?: number;
}
