import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsNumber, IsBoolean, IsString, IsArray } from 'class-validator';

/**
 * Client-side device data from navigator APIs
 */
export class ClientDeviceDto {
  @ApiProperty({ description: 'Screen width in pixels', required: false })
  @IsOptional()
  @IsNumber()
  screenWidth?: number;

  @ApiProperty({ description: 'Screen height in pixels', required: false })
  @IsOptional()
  @IsNumber()
  screenHeight?: number;

  @ApiProperty({ description: 'Viewport width in pixels', required: false })
  @IsOptional()
  @IsNumber()
  viewportWidth?: number;

  @ApiProperty({ description: 'Viewport height in pixels', required: false })
  @IsOptional()
  @IsNumber()
  viewportHeight?: number;

  @ApiProperty({ description: 'Device pixel ratio', required: false })
  @IsOptional()
  @IsNumber()
  pixelRatio?: number;

  @ApiProperty({ description: 'Color depth in bits', required: false })
  @IsOptional()
  @IsNumber()
  colorDepth?: number;

  @ApiProperty({ description: 'Primary language (navigator.language)', required: false })
  @IsOptional()
  @IsString()
  language?: string;

  @ApiProperty({ description: 'All accepted languages', required: false, type: [String] })
  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  languages?: string[];

  @ApiProperty({ description: 'Timezone (Intl.DateTimeFormat)', required: false })
  @IsOptional()
  @IsString()
  timezone?: string;

  @ApiProperty({ description: 'Timezone offset in minutes', required: false })
  @IsOptional()
  @IsNumber()
  timezoneOffset?: number;

  @ApiProperty({ description: 'Device memory in GB', required: false })
  @IsOptional()
  @IsNumber()
  deviceMemory?: number;

  @ApiProperty({ description: 'CPU cores (navigator.hardwareConcurrency)', required: false })
  @IsOptional()
  @IsNumber()
  hardwareConcurrency?: number;

  @ApiProperty({ description: 'Max touch points', required: false })
  @IsOptional()
  @IsNumber()
  touchPoints?: number;

  @ApiProperty({ description: 'Cookies enabled', required: false })
  @IsOptional()
  @IsBoolean()
  cookiesEnabled?: boolean;

  @ApiProperty({ description: 'Do Not Track header set', required: false })
  @IsOptional()
  @IsBoolean()
  doNotTrack?: boolean;
}
