import { IsString, IsOptional, IsObject, ValidateNested, IsIn } from 'class-validator';
import { Type } from 'class-transformer';

export class UserPreferencesDto {
  @IsOptional()
  notifications?: boolean;

  @IsOptional()
  emailUpdates?: boolean;

  @IsOptional()
  darkMode?: boolean;

  @IsOptional()
  @IsIn(['metric', 'imperial'])
  measurementUnit?: 'metric' | 'imperial';

  @IsOptional()
  @IsIn(['12h', '24h'])
  timeFormat?: '12h' | '24h';
}

export class UpdateProfileDto {
  @IsOptional()
  @IsString()
  name?: string;

  @IsOptional()
  @IsString()
  photoUrl?: string;

  @IsOptional()
  @IsString()
  locale?: string;

  @IsOptional()
  @IsString()
  timezone?: string;

  @IsOptional()
  @IsObject()
  @ValidateNested()
  @Type(() => UserPreferencesDto)
  preferences?: UserPreferencesDto;
}
