import { BookingVerification } from '../../domain/entities/booking-verification.entity';
import { IsString, IsNotEmpty, Matches } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class BookingVerificationDto implements BookingVerification {
  id: string;

  @ApiProperty({
    type: String,
    required: true,
    example: 'John Doe',
    description: 'Name of the person booking',
  })
  @IsString()
  @IsNotEmpty()
  name: string;

  @ApiProperty({
    type: String,
    required: true,
    example: '628123456789',
    description: 'Phone number containing only numeric characters',
  })
  @IsString()
  @IsNotEmpty()
  @Matches(/^\d+$/, {
    message: 'phone_number must contain only numeric characters',
  })
  phone_number: string;
}

export class VerificationCodeDto implements BookingVerification {
  id: string;

  @ApiProperty({
    type: String,
    required: true,
    example: 'John Doe',
    description: 'Name of the person booking',
  })
  @IsString()
  @IsNotEmpty()
  name: string;

  @ApiProperty({
    type: String,
    required: true,
    example: '628123456789',
    description: 'Phone number containing only numeric characters',
  })
  @IsString()
  @IsNotEmpty()
  @Matches(/^\d+$/, {
    message: 'phone_number must contain only numeric characters',
  })
  phone_number: string;

  @ApiProperty({
    type: String,
    required: true,
    example: '1234',
    description: 'Verification code',
  })
  @IsString()
  @IsNotEmpty()
  code?: string;
}
