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

/**
 * DTO used to search for associates based on optional filters.
 *
 * Currently supports filtering by `product_id`. This can be extended in the future
 * to include more search parameters like country, association type, etc.
 */
export class SearchAssociatesDto {
  /**
   * Optional product ID to filter associates associated with a specific product.
   *
   * Validation rules:
   * - Must be a string if provided
   * - Optional field; the API can return all associates if this is not provided
   *
   * Example payload:
   * ```json
   * {
   *   "product_id": "PROD12345"
   * }
   * ```
   */
  @ApiPropertyOptional({
    description: 'Optional product ID to filter associates',
    example: 'PROD12345',
  })
  @IsOptional()
  @IsString({ message: 'Product ID must be a string' })
  product_id?: string;
}
