deviceRepository = $deviceRepository; } /** * Find merge suggestions for a discovered host. * Returns array of ['device' => Device, 'confidence' => int, 'reason' => string] */ public function findSuggestions(DiscoveredHost $host): array { $suggestions = []; // High confidence: MAC address match if ($host->macAddress !== null) { $device = $this->deviceRepository->findByMac($host->macAddress); if ($device !== null) { $suggestions[] = [ 'device' => $device, 'confidence' => 90, 'reason' => 'MAC адрес совпадает', ]; } } // Medium confidence: hostname match if ($host->hostname !== null) { $device = $this->deviceRepository->findByName($host->hostname); if ($device !== null) { $suggestions[] = [ 'device' => $device, 'confidence' => 60, 'reason' => 'Hostname совпадает', ]; } } if ($host->ipAddress !== '') { $device = $this->deviceRepository->findByIp($host->ipAddress); if ($device !== null) { $suggestions[] = [ 'device' => $device, 'confidence' => 40, 'reason' => 'IP адрес совпадает', ]; } } return $suggestions; } }