/// Re-exports [KcBootstrap] from the shared `core` package and provides
/// a backward-compatible [Bootstrap] wrapper for `kell_web`.
///
/// This file preserves the existing `Bootstrap.run(config)` call site.
/// New code should use [KcBootstrap.run] from `package:core/core.dart`
/// with a [KcServiceFactory] directly.
library;

import 'package:core/core.dart';

import 'app_services.dart';

export 'package:core/core.dart' show KcBootstrap;

/// Backward-compatible bootstrap for `kell_web`.
///
/// Delegates to [KcBootstrap.run] using the [AppServices.serviceFactory].
///
/// Existing call sites:
/// ```dart
/// final (:services, config: effectiveConfig) = Bootstrap.run(config);
/// ```
///
/// New code should prefer:
/// ```dart
/// final (:services, config: effectiveConfig) = KcBootstrap.run(
///   config,
///   AppServices.serviceFactory,
/// );
/// ```
class Bootstrap {
  const Bootstrap._();

  /// Creates the appropriate [AppServices] for the given [config].
  ///
  /// Returns a record containing the resolved services and the effective
  /// config (which may differ from the input when WordPress credentials are
  /// missing and a fallback to fake mode occurs).
  static ({AppServices services, KcAppConfig config}) run(KcAppConfig config) {
    return KcBootstrap.run<AppServices>(config, AppServices.serviceFactory);
  }
}
