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

export class CreateApplicantDto {
  @ApiProperty({ description: 'DigiLocker ID', example: 'DL-GOA-123456789' })
  @IsString()
  @IsNotEmpty()
  @MaxLength(255)
  digilockerId: string;

  @ApiProperty({ description: 'Full name', example: 'John Doe' })
  @IsString()
  @IsNotEmpty()
  @MaxLength(255)
  name: string;

  @ApiProperty({ description: 'Email address', example: 'john@example.com' })
  @IsEmail()
  @IsNotEmpty()
  email: string;

  @ApiPropertyOptional({ description: 'Phone number', example: '+91-9876543210' })
  @IsString()
  @IsOptional()
  @MaxLength(20)
  phone?: string;

  @ApiPropertyOptional({ description: 'Ethereum wallet address' })
  @IsString()
  @IsOptional()
  @MaxLength(42)
  walletAddress?: string;
}

export class UpdateApplicantDto extends PartialType(CreateApplicantDto) {}

export class ApplicantResponseDto {
  @ApiProperty()
  id: string;

  @ApiProperty()
  digilockerId: string;

  @ApiProperty()
  name: string;

  @ApiProperty()
  email: string;

  @ApiPropertyOptional()
  phone?: string;

  @ApiPropertyOptional()
  walletAddress?: string;

  @ApiProperty()
  isActive: boolean;

  @ApiProperty()
  createdAt: Date;

  @ApiProperty()
  updatedAt: Date;
}
