import {
  IsEmail,
  IsString,
  MinLength,
  IsOptional,
  IsObject,
  IsDateString,
  IsBoolean,
} from 'class-validator';

export class DeviceInfoDto {
  @IsString()
  deviceId: string;

  @IsString()
  platform: string;

  @IsString()
  model: string;

  @IsString()
  osVersion: string;
}

export class RegisterDto {
  @IsEmail()
  email: string;

  @IsString()
  @MinLength(8)
  password: string;

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

  @IsString()
  name: string;

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

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

  // COPPA compliance fields
  @IsDateString()
  dateOfBirth: string; // ISO date string (YYYY-MM-DD)

  @IsOptional()
  @IsBoolean()
  coppaConsentGiven?: boolean; // For users 13-17, parental consent

  @IsOptional()
  @IsEmail()
  parentalEmail?: string; // Parent/guardian email for users 13-17

  @IsObject()
  deviceInfo: DeviceInfoDto;
}
