// This file is automatically generated, so please do not edit it.
// @generated by `flutter_rust_bridge`@ 2.12.0.

// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';

import 'api/error.dart';
import 'frb_generated.dart';

// These functions are ignored because they are not marked as `pub`: `new_whitenoise_with_timeout`, `release_lifecycle`, `to_core_config`, `wn_session`, `wn`
// These types are ignored because they are neither used by any `pub` functions nor (for structs and enums) marked `#[frb(unignore)]`: `WnHandle`, `WnSessionHandle`
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `deref`, `deref`, `fmt`, `from`

/// Creates a `WhitenoiseConfig` object from string directory paths.
///
/// This function bridges the gap between Flutter's string-based paths and Rust's
/// `Path` types, creating a proper configuration object for Whitenoise initialization.
///
/// # Parameters
/// * `data_dir` - Path string for data directory where app data will be stored
/// * `logs_dir` - Path string for logs directory where log files will be written
/// * `default_relay_urls` - Optional relay URLs for test or environment-specific defaults
///
/// # Returns
/// A WhitenoiseConfig object ready for initialization
///
/// # Example
/// ```rust
/// let config = create_whitenoise_config(
///     "/path/to/data".to_string(),
///     "/path/to/logs".to_string()
/// );
/// ```
Future<WhitenoiseConfig> createWhitenoiseConfig({
  required String dataDir,
  required String logsDir,
  List<String>? defaultRelayUrls,
}) => RustLib.instance.api.crateApiCreateWhitenoiseConfig(
  dataDir: dataDir,
  logsDir: logsDir,
  defaultRelayUrls: defaultRelayUrls,
);

Future<void> initializeWhitenoise({required WhitenoiseConfig config}) =>
    RustLib.instance.api.crateApiInitializeWhitenoise(config: config);

Future<void> reinitializeWhitenoise() => RustLib.instance.api.crateApiReinitializeWhitenoise();

/// Wipes all on-disk data and clears the process-global Whitenoise instance.
/// The lifecycle write lock waits for in-flight bridge calls before the old
/// database pool is closed, then blocks new bridge calls until the global
/// instance has been cleared. Call `initialize_whitenoise` to install a fresh
/// instance after the reset.
Future<void> deleteAllData() => RustLib.instance.api.crateApiDeleteAllData();

Future<AppSettings> getAppSettings() => RustLib.instance.api.crateApiGetAppSettings();

Future<void> updateThemeMode({required ThemeMode themeMode}) =>
    RustLib.instance.api.crateApiUpdateThemeMode(themeMode: themeMode);

Future<ThemeMode> appSettingsThemeMode({required AppSettings appSettings}) =>
    RustLib.instance.api.crateApiAppSettingsThemeMode(appSettings: appSettings);

Future<void> updateLanguage({required Language language}) =>
    RustLib.instance.api.crateApiUpdateLanguage(language: language);

Future<Language> appSettingsLanguage({required AppSettings appSettings}) =>
    RustLib.instance.api.crateApiAppSettingsLanguage(appSettings: appSettings);

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<AppSettings>>
abstract class AppSettings implements RustOpaqueInterface {}

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<Language>>
abstract class Language implements RustOpaqueInterface {}

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<ThemeMode>>
abstract class ThemeMode implements RustOpaqueInterface {}

/// Flutter-compatible configuration structure that holds directory paths as strings.
///
/// This struct is used to pass configuration data from Flutter to Rust, as flutter_rust_bridge
/// cannot directly handle `Path` types. The paths are converted to proper `Path` objects
/// internally when creating a `WhitenoiseConfig`.
class WhitenoiseConfig {
  /// Path to the directory where application data will be stored
  final String dataDir;

  /// Path to the directory where log files will be written
  final String logsDir;

  /// Relay URLs used when the app needs to create default relay metadata.
  final List<String>? defaultRelayUrls;

  const WhitenoiseConfig({
    required this.dataDir,
    required this.logsDir,
    this.defaultRelayUrls,
  });

  @override
  int get hashCode => dataDir.hashCode ^ logsDir.hashCode ^ defaultRelayUrls.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is WhitenoiseConfig &&
          runtimeType == other.runtimeType &&
          dataDir == other.dataDir &&
          logsDir == other.logsDir &&
          defaultRelayUrls == other.defaultRelayUrls;
}
