import { IsString, IsEnum, IsOptional, MaxLength } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { DevicePlatform, PushChannel } from '../../../domain/entities/device-token.entity';

export class RegisterDeviceTokenDto {
  @ApiProperty({ enum: DevicePlatform, description: 'Device OS platform', example: 'ANDROID' })
  @IsEnum(DevicePlatform)
  platform: DevicePlatform;

  @ApiProperty({ enum: PushChannel, description: 'Push channel', example: 'FCM' })
  @IsEnum(PushChannel)
  channel: PushChannel;

  @ApiProperty({ description: 'Device push token from FCM/APNs/HMS/etc.' })
  @IsString()
  token: string;

  @ApiPropertyOptional({ description: 'Unique device identifier' })
  @IsOptional()
  @IsString()
  @MaxLength(200)
  deviceId?: string;

  @ApiPropertyOptional({ description: 'Device model name', example: 'Pixel 8 Pro' })
  @IsOptional()
  @IsString()
  @MaxLength(200)
  deviceModel?: string;

  @ApiPropertyOptional({ description: 'App version', example: '1.2.0' })
  @IsOptional()
  @IsString()
  @MaxLength(50)
  appVersion?: string;
}

export class UnregisterDeviceTokenDto {
  @ApiProperty({ description: 'Device push token to unregister' })
  @IsString()
  token: string;
}
