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

/**
 * DTO for searching courses offered by a college across multiple campuses and study levels.
 *
 * This DTO is typically used to fetch course information filtered by:
 * 1. College/Institute ID
 * 2. One or more campuses
 * 3. One or more study levels
 */
export class SearchCollegeCampusCoursesDto {
  /**
   * ID of the institute/college (required)
   *
   * Validation:
   * - Must be a number
   * - Cannot be empty
   *
   * Example: 101
   */
  @ApiProperty({ description: 'ID of the institute/college' })
  @IsNotEmpty({ message: 'Institute ID is required' })
  @IsNumber({}, { message: 'Institute ID must be a number' })
  institute_id: number;

  /**
   * List of campus IDs to filter courses (required)
   *
   * Validation:
   * - Must be an array
   * - Cannot be empty
   *
   * Example: [1, 2, 3]
   */
  @ApiProperty({ description: 'Array of campus IDs' })
  @IsNotEmpty({ message: 'At least one campus must be selected' })
  @IsArray({ message: 'Campuses must be an array of numbers' })
  campuses: number[];

  /**
   * List of study level IDs to filter courses (required)
   *
   * Validation:
   * - Must be an array
   * - Cannot be empty
   *
   * Example: [101, 102] (representing Bachelor, Master levels, etc.)
   */
  @ApiProperty({ description: 'Array of study level IDs' })
  @IsNotEmpty({ message: 'At least one study level must be selected' })
  @IsArray({ message: 'Study levels must be an array of numbers' })
  study_levels: number[];
}
