import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsDateString, IsOptional, IsString } from 'class-validator';
import { PaginationDto } from 'src/config/pagination/paginationDto';

/**
 * Data Transfer Object (DTO) for searching release notes with optional filters.
 *
 * Extends PaginationDto to support paginated queries. Allows filtering by
 * release version (string) and release date (date string). Decorators are used
 * for validation and Swagger API documentation.
 */
export class SearchReleaseNotesDto extends PaginationDto {
  /**
   * Optional filter for the release version string.
   * - @ApiPropertyOptional: Marks as optional in Swagger docs.
   * - @IsOptional: Validation is skipped if not provided.
   * - @IsString: Must be a string if provided.
   */
  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  release_version?: string;

  /**
   * Optional filter for the release date.
   * - @ApiPropertyOptional: Marks as optional in Swagger docs.
   * - @IsOptional: Validation is skipped if not provided.
   * - @IsDateString: Must be a valid date string if provided.
   */
  @ApiPropertyOptional()
  @IsOptional()
  @IsDateString()
  release_date?: Date;
}
