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

/**
 * DTO for searching visa cases with multiple optional filters.
 * All fields are optional and allow filtering visa cases based on country, institute, intake, commission instance, associate, and contract details.
 */
export class SearchVisaCasesDto {
  /**
   * Optional ID of the visa service country to filter visa cases.
   * Example: 9 for a specific country.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases 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 visa cases.
   * Example: 459 for a specific institute.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases 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 visa cases.
   * Example: 80 for India.
   */
  @ApiPropertyOptional({
    description: "Filter visa cases by client's home country ID",
    example: 80,
  })
  @IsOptional()
  @IsNumber({}, { message: 'client_from_country_id must be a number' })
  client_from_country_id?: number;

  /**
   * Optional ID of the intake/session to filter visa cases.
   * Example: 95504 for a particular intake.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases by intake/session ID',
    example: 95504,
  })
  @IsOptional()
  @IsNumber({}, { message: 'intake_id must be a number' })
  intake_id?: number;

  /**
   * Optional ID of the commission instance to filter visa cases.
   * Example: 3 for a specific commission instance.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases by commission instance ID',
    example: 3,
  })
  @IsOptional()
  @IsNumber({}, { message: 'commission_instance_id must be a number' })
  commission_instance_id?: number;

  /**
   * Optional ID of the associate to filter visa cases.
   * Example: 9 for a specific associate.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases by associate ID',
    example: 9,
  })
  @IsOptional()
  @IsNumber({}, { message: 'associate_id must be a number' })
  associate_id?: number;

  /**
   * Optional association type ID to filter visa cases.
   * Example: 1 for Institute, 2 for Branch, etc.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases by association type ID',
    example: 1,
  })
  @IsOptional()
  @IsNumber({}, { message: 'association_type must be a number' })
  association_type?: number;

  /**
   * Optional ID indicating what the commission is applicable on.
   * Example: 2 for a specific type of applicability.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases by applicable on ID',
    example: 2,
  })
  @IsOptional()
  @IsNumber({}, { message: 'applicable_on_id must be a number' })
  applicable_on_id?: number;

  /**
   * Optional contract set ID to filter visa cases.
   * Example: 2 for a specific contract set.
   */
  @ApiPropertyOptional({
    description: 'Filter visa cases by contract set ID',
    example: 2,
  })
  @IsOptional()
  @IsNumber({}, { message: 'contract_set_id must be a number' })
  contract_set_id?: number;
}
