import { Type } from 'class-transformer'; import { IsArray, IsEnum, IsISO8601, IsNumber, IsOptional, IsString, Max, MaxLength, Min, ValidateNested, } from 'class-validator'; import { AssetGeometryType } from '../../database/entities'; export class AssetGeometryPayloadDto { @IsEnum(AssetGeometryType) type!: AssetGeometryType; @IsArray() coordinates!: unknown[]; } export class UpsertAssetGeometryDto { @ValidateNested() @Type(() => AssetGeometryPayloadDto) geometry!: AssetGeometryPayloadDto; @IsOptional() @Type(() => Number) @IsNumber({ maxDecimalPlaces: 3 }) @Min(0) @Max(100_000) accuracyM?: number | null; @IsOptional() @IsISO8601({ strict: true }) capturedAt?: string | null; @IsOptional() @IsString() @MaxLength(255) deviceLabel?: string | null; }