integrationService = new GoogleSheetsService(); } /** * Sync from Google Sheets to CRM * Called by Script Builder via cron */ public function syncFromSheets(): void { try { $results = $this->integrationService->syncFromGoogleSheets(); $this->jsonResponse([ 'success' => true, 'message' => 'Synchronization completed successfully', 'data' => $results ], 200); } catch (\Exception $e) { $this->errorResponse('Synchronization failed: ' . $e->getMessage(), 500); } } /** * Get sync status and statistics */ public function getSyncStats(): void { try { $stats = $this->integrationService->getSyncStats(); $this->jsonResponse([ 'success' => true, 'data' => $stats ], 200); } catch (\Exception $e) { $this->errorResponse('Failed to get sync stats: ' . $e->getMessage(), 500); } } }