// 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 '../frb_generated.dart';
import 'error.dart';

// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `assert_fields_are_eq`, `clone`, `eq`, `fmt`, `from`

/// Subscribe to real-time group state events for a single `(account, group)` pair.
///
/// Streams [`GroupStateUpdate::LeftGroup`] when the account leaves the group
/// (e.g. via SelfRemove) and [`GroupStateUpdate::RemovedFromGroup`] when an
/// admin removes the account. Real-time only — there is no initial snapshot.
///
/// Open chat views can subscribe alongside `subscribe_to_group_messages` to
/// react when membership ends without also driving a chat-list subscription.
///
/// Returns `ApiError::Whitenoise` (carrying `WhitenoiseError::GroupNotFound`)
/// if the `(account, group)` pair has no AccountGroup row.
Stream<GroupStateUpdate> subscribeToGroupState({
  required String accountPubkey,
  required String mlsGroupId,
}) => RustLib.instance.api.crateApiGroupStateSubscribeToGroupState(
  accountPubkey: accountPubkey,
  mlsGroupId: mlsGroupId,
);

/// Real-time group state event for the subscribed `(account, group)` pair.
///
/// Group state events are membership transitions, not persistent state, so the
/// stream has no initial snapshot — it only emits as transitions happen.
enum GroupStateUpdate {
  /// The account voluntarily left the group.
  leftGroup,

  /// The account was removed from the group by an admin.
  removedFromGroup,
}
