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

export class UpdateMyProfileDto {
  @ApiPropertyOptional({ example: 'Ada', description: 'First name shown on the profile.' })
  @IsOptional()
  @IsString()
  @MaxLength(80)
  firstName?: string;

  @ApiPropertyOptional({ example: 'Okafor', description: 'Last name shown on the profile.' })
  @IsOptional()
  @IsString()
  @MaxLength(80)
  lastName?: string;

  @ApiPropertyOptional({ example: 'ada@example.com', description: 'Optional email address for email notifications.' })
  @IsOptional()
  @IsEmail()
  email?: string;

  @ApiPropertyOptional({ example: 'Block A', description: 'Resident block number or building identifier.' })
  @IsOptional()
  @IsString()
  @MaxLength(80)
  blockNumber?: string;

  @ApiPropertyOptional({ example: 'Flat 12', description: 'Resident flat, apartment, or house number.' })
  @IsOptional()
  @IsString()
  @MaxLength(80)
  flatNumber?: string;

  @ApiPropertyOptional({ example: 'Block A, Flat 12, GreenPark Estate', description: 'Profile address inside or outside the estate.' })
  @IsOptional()
  @IsString()
  @MaxLength(240)
  address?: string;

  @ApiPropertyOptional({ example: 'https://cdn.example.com/profile.jpg', description: 'Processed profile photo URL.' })
  @IsOptional()
  @IsString()
  @MaxLength(500)
  profilePictureUrl?: string;

  @ApiPropertyOptional({ example: 'https://cdn.example.com/profile-thumb.jpg', description: 'Processed thumbnail URL.' })
  @IsOptional()
  @IsString()
  @MaxLength(500)
  profilePictureThumbnailUrl?: string;

  @ApiPropertyOptional({
    example: { name: 'Emergency Contact', phone: '+2348000000999' },
    description: 'Emergency contact object. Guards need this for 100% completion.'
  })
  @IsOptional()
  @IsObject()
  emergencyContact?: Record<string, unknown>;

  @ApiPropertyOptional({
    example: [{ name: 'Tola Okafor', relationship: 'Spouse', phone: '+2348000000888' }],
    description: 'Resident household/family members array.'
  })
  @IsOptional()
  householdMembers?: unknown[];

  @ApiPropertyOptional({
    example: { originalBytes: 2400000, compressedBytes: 180000, width: 512, height: 512, thumbWidth: 128, thumbHeight: 128 },
    description: 'Client or media-service profile image processing metadata.'
  })
  @IsOptional()
  @IsObject()
  profileImageMetadata?: Record<string, unknown>;

  @ApiPropertyOptional({ example: true, description: 'User confirmation that profile information is correct.' })
  @IsOptional()
  @IsBoolean()
  profileConfirmed?: boolean;
}
