import { ApiProperty } from '@nestjs/swagger';
import { DevicePlatform } from '@prisma/client';
import { IsEnum, IsString, IsUUID, MinLength } from 'class-validator';

export class RegisterDeviceRequestDto {
  @ApiProperty({ enum: DevicePlatform, example: DevicePlatform.MACOS })
  @IsEnum(DevicePlatform)
  platform!: DevicePlatform;

  @ApiProperty({ example: 'Diya MacBook Pro' })
  @IsString()
  @MinLength(1)
  deviceName!: string;

  @ApiProperty({ example: '0.1.0' })
  @IsString()
  @MinLength(1)
  appVersion!: string;
}

export class RegisterDeviceResponseDto {
  @ApiProperty({ format: 'uuid' })
  deviceId!: string;

  @ApiProperty()
  bootstrapToken!: string;

  @ApiProperty({ example: '2026-05-24T20:00:00.000Z' })
  serverTime!: string;
}

export class DeviceHeartbeatRequestDto {
  @ApiProperty({ format: 'uuid' })
  @IsUUID()
  deviceId!: string;

  @ApiProperty({ example: '0.1.0' })
  @IsString()
  @MinLength(1)
  appVersion!: string;
}

export class DeviceHeartbeatResponseDto {
  @ApiProperty({ example: true })
  ok!: boolean;

  @ApiProperty({ example: '2026-05-24T20:00:00.000Z' })
  serverTime!: string;
}
