import { IsOptional, IsString, IsInt, IsBoolean } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';

export class UpdateServerConfigDto {
  @ApiPropertyOptional({ example: 'My Rust Server', description: 'Server name' })
  @IsOptional()
  @IsString()
  server_name?: string;

  @ApiPropertyOptional({ example: 100, description: 'Maximum players' })
  @IsOptional()
  @IsInt()
  max_players?: number;

  @ApiPropertyOptional({ example: 4000, description: 'World size' })
  @IsOptional()
  @IsInt()
  world_size?: number;

  @ApiPropertyOptional({ example: 123456, description: 'Current world seed' })
  @IsOptional()
  @IsInt()
  current_seed?: number;

  @ApiPropertyOptional({ example: true, description: 'Enable auto-restart' })
  @IsOptional()
  @IsBoolean()
  auto_restart_enabled?: boolean;

  @ApiPropertyOptional({ example: '0 4 * * *', description: 'Auto-restart cron schedule' })
  @IsOptional()
  @IsString()
  auto_restart_cron?: string;

  @ApiPropertyOptional({ example: true, description: 'Enable crash recovery' })
  @IsOptional()
  @IsBoolean()
  crash_recovery_enabled?: boolean;

  @ApiPropertyOptional({ example: true, description: 'Eligible for force wipes' })
  @IsOptional()
  @IsBoolean()
  force_wipe_eligible?: boolean;

  @ApiPropertyOptional({ example: true, description: 'Auto-update on force wipe' })
  @IsOptional()
  @IsBoolean()
  auto_update_on_force_wipe?: boolean;

  @ApiPropertyOptional({
    example: { 'server.pve': 'true', 'server.radiation': 'false' },
    description: 'Server config overrides (key-value pairs)',
  })
  @IsOptional()
  config_overrides?: Record<string, string>;
}
