success; } public function getComponentsAdded(): array { return $this->componentsAdded; } public function getComponentsUpdated(): array { return $this->componentsUpdated; } public function getComponentsDeleted(): array { return $this->componentsDeleted; } public function getErrors(): array { return $this->errors; } /** * Factory method: Sincronización exitosa */ public static function success( array $added, array $updated, array $deleted ): self { return new self(true, $added, $updated, $deleted, []); } /** * Factory method: Sincronización con errores */ public static function failure(array $errors): self { return new self(false, [], [], [], $errors); } /** * Convertir a array */ public function toArray(): array { return [ 'success' => $this->success, 'components_added' => $this->componentsAdded, 'components_updated' => $this->componentsUpdated, 'components_deleted' => $this->componentsDeleted, 'errors' => $this->errors ]; } /** * Obtener resumen de cambios */ public function getSummary(): string { $added = count($this->componentsAdded); $updated = count($this->componentsUpdated); $deleted = count($this->componentsDeleted); return sprintf( 'Added: %d, Updated: %d, Deleted: %d', $added, $updated, $deleted ); } }