['required', 'string', 'max:191'], 'station_id' => ['nullable', 'string', 'max:191'], 'scan_action' => ['nullable', 'string', 'in:check_in,check_out,lookup'], 'scan_source' => ['nullable', 'string', 'in:scanner,manual,api'], 'scanned_at' => ['nullable', 'date'], 'device_id' => ['nullable', 'string', 'max:191'], 'client_request_id' => ['nullable', 'string', 'max:191'], 'idempotency_key' => ['nullable', 'string', 'max:191'], 'metadata' => ['nullable', 'array'], ]; } public function toDTO(): ProcessScanData { $validated = $this->validated(); return new ProcessScanData( badgeValue: (string) $validated['badge_value'], stationId: $validated['station_id'] ?? null, scanAction: $validated['scan_action'] ?? 'check_in', scanSource: $validated['scan_source'] ?? 'scanner', scannedAt: new DateTimeImmutable($validated['scanned_at'] ?? 'now'), deviceId: $validated['device_id'] ?? null, clientRequestId: $validated['client_request_id'] ?? null, idempotencyKey: $validated['idempotency_key'] ?? null, metadata: $validated['metadata'] ?? [], ); } }