import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsInt, IsNotEmpty, IsOptional, IsString, Matches, Max, Min, } from 'class-validator'; export class UpdateCompanySettingDto { @ApiPropertyOptional({ example: '2026-01-05', description: 'YYYY-MM-DD' }) @IsOptional() @IsString() @IsNotEmpty() @Matches(/^\d{4}-\d{2}-\d{2}$/, { message: 'cycleStartDate must be a calendar date', }) cycleStartDate?: string; @ApiPropertyOptional({ example: 100, minimum: 1, maximum: 10000 }) @IsOptional() @IsInt() @Min(1) @Max(10_000) checkInRadiusMeters?: number; @ApiPropertyOptional({ example: 5, minimum: 5, maximum: 300 }) @IsOptional() @IsInt() @Min(5) @Max(300) gpsIntervalSeconds?: number; @ApiPropertyOptional({ example: 200, minimum: 1, maximum: 10000 }) @IsOptional() @IsInt() @Min(1) @Max(10_000) checkoutWarningRadiusMeters?: number; } export class CompanySettingDto { @ApiProperty({ format: 'uuid' }) id!: string; @ApiProperty({ description: 'Unix ms start of the cycle-start calendar day' }) cycleStartDate!: number; @ApiProperty({ example: 100 }) checkInRadiusMeters!: number; @ApiProperty({ example: 5 }) gpsIntervalSeconds!: number; @ApiProperty({ example: 200 }) checkoutWarningRadiusMeters!: number; @ApiProperty() status!: string; @ApiProperty() createdAt!: number; @ApiProperty() updatedAt!: number; @ApiProperty({ format: 'uuid' }) createdBy!: string; @ApiProperty({ format: 'uuid' }) updatedBy!: string; }