import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsPhoneNumber, IsString, MinLength } from 'class-validator';
import { ESTATE_ID_EXAMPLE } from '../../common/swagger-docs';

export class CreateVisitorDto {
  @ApiProperty({ example: ESTATE_ID_EXAMPLE, description: 'Estate that owns this visitor record.' })
  @IsString()
  estateId!: string;

  @ApiProperty({ example: 'Ade Okafor', description: 'Visitor full name.' })
  @IsString()
  @MinLength(2)
  name!: string;

  @ApiPropertyOptional({ example: '+2348111111111', description: 'Visitor phone number if available.' })
  @IsOptional()
  @IsPhoneNumber()
  phone?: string;

  @ApiPropertyOptional({ example: 'LND-123-AB', description: 'Vehicle plate for gate matching.' })
  @IsOptional()
  @IsString()
  vehiclePlate?: string;

  @ApiPropertyOptional({ example: 'https://example.com/photo.jpg', description: 'Optional visitor photo URL.' })
  @IsOptional()
  @IsString()
  photoUrl?: string;
}
