option('no-interaction') && ! confirm('Do you want to continue?', true)) { info('Rebuild cancelled.'); return self::SUCCESS; } $batchSize = (int) $this->option('batch-size'); $transformBatchSize = (int) $this->option('transform-batch-size'); $useQueue = $this->option('queue'); // Step 1: Full Sync info('Step 1/2: Full Sync from Backend'); $syncJob = new SyncBackendDataPool( fullSync: true, batchSize: $batchSize ); if ($useQueue) { info('Dispatching sync job to queue...'); dispatch($syncJob); info('Sync job dispatched!'); warning('Please wait for the sync job to complete before transformation.'); return self::SUCCESS; } else { spin( fn () => $syncJob->handle(), 'Syncing data from backend...' ); info('✓ Sync completed!'); } $this->newLine(); // Step 2: Transform Data info('Step 2/2: Transform Data Pool to Production'); $transformJob = new TransformDataPoolToProduction(batchSize: $transformBatchSize); spin( fn () => $transformJob->handle(), 'Transforming data...' ); info('✓ Transformation completed!'); $this->newLine(); info('Complete rebuild finished successfully!'); return self::SUCCESS; } }