import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsIn, IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator'; import { MqttLogMessageDto } from '../../ingest/dto/mqtt-messages.dto'; export type SimTransport = 'relay' | 'mqtts'; // What the simulator UI sends the backend: a devices//log payload // (type: "log" persists a point, "status" is a live-only position update) // plus "serial", which lives in the topic rather than the wire payload. export class SimPublishPointDto extends MqttLogMessageDto { @ApiProperty({ description: 'Locator serial number; identifies the device via devices//log' }) @IsString() @IsNotEmpty() @MaxLength(64) serial: string; @ApiPropertyOptional({ description: '"relay" (default) publishes via the backend\'s own privileged broker connection. ' + '"mqtts" instead connects to port 8883 and authenticates as this serial\'s own issued ' + 'client certificate, exercising the real device-auth + ACL path.', enum: ['relay', 'mqtts'], }) @IsOptional() @IsIn(['relay', 'mqtts']) transport?: SimTransport; }