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

/**
 * Query params to locate a user by their contact details.
 * All fields are optional, but at least one of phoneNumber / email must be supplied.
 * Values are trimmed (and email lower-cased) at the query layer, and multiple
 * combinations (country code + phone, phone alone, primary/alternate email)
 * are attempted before giving up.
 */
export class CheckHdbMsdQueryDto {
  @ApiPropertyOptional({ example: '+91', description: 'Country code, e.g. +91' })
  @IsOptional()
  @IsString()
  countryCode?: string;

  @ApiPropertyOptional({ example: '9876543210', description: 'Phone number (with or without country code)' })
  @IsOptional()
  @IsString()
  phoneNumber?: string;

  @ApiPropertyOptional({ example: 'john.doe@gmail.com', description: 'Email address' })
  @IsOptional()
  @IsString()
  email?: string;
}

/**
 * Whether the resolved user has attended an HDB or MSD program.
 */
export class HdbMsdCheckResponseDto {
  @ApiProperty({ example: 123, description: 'Resolved user id' })
  userId: number;

  @ApiProperty({ example: true, description: 'True if the user attended an HDB or MSD program' })
  attendedHdbMsd: boolean;
}
