// 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 '../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.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): `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`

/// Synchronous fallible command. Proves Dart → Rust call with a typed
/// `Result` DTO crossing the boundary.
GreetResult greet({required String name}) =>
    RustLib.instance.api.crateApiSimpleGreet(name: name);

/// Rust → Dart event stream.
/// `StreamSink` is provided in scope by `flutter_rust_bridge` glue;
/// the codegen wires it to a Dart `Stream<CounterTick>`.
Stream<CounterTick> counterStream({
  required int count,
  required int intervalMs,
}) => RustLib.instance.api.crateApiSimpleCounterStream(
  count: count,
  intervalMs: intervalMs,
);

class CounterTick {
  final BigInt seq;
  final String note;

  const CounterTick({required this.seq, required this.note});

  @override
  int get hashCode => seq.hashCode ^ note.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is CounterTick &&
          runtimeType == other.runtimeType &&
          seq == other.seq &&
          note == other.note;
}

/// Typed error DTO surfaced as a Dart exception by FRB.
class GreetError implements FrbException {
  final GreetErrorKind kind;
  final String detail;

  const GreetError({required this.kind, required this.detail});

  @override
  int get hashCode => kind.hashCode ^ detail.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is GreetError &&
          runtimeType == other.runtimeType &&
          kind == other.kind &&
          detail == other.detail;
}

enum GreetErrorKind { emptyName }

class GreetResult {
  final String message;
  final BigInt elapsedMicros;

  const GreetResult({required this.message, required this.elapsedMicros});

  @override
  int get hashCode => message.hashCode ^ elapsedMicros.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is GreetResult &&
          runtimeType == other.runtimeType &&
          message == other.message &&
          elapsedMicros == other.elapsedMicros;
}
