// 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 'package:freezed_annotation/freezed_annotation.dart' hide protected;

import '../frb_generated.dart';

part 'error.freezed.dart';

// These functions are ignored because they are not marked as `pub`: `is_database_pool_timeout`
// 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`, `fmt`, `fmt`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`

@freezed
sealed class ApiError with _$ApiError implements FrbException {
  const ApiError._();

  /// Core whitenoise library errors
  const factory ApiError.whitenoise({
    required String message,
  }) = ApiError_Whitenoise;
  const factory ApiError.databasePoolTimedOut({
    required String message,
  }) = ApiError_DatabasePoolTimedOut;
  const factory ApiError.invalidKey({
    required String message,
  }) = ApiError_InvalidKey;
  const factory ApiError.nostrUrl({
    required String message,
  }) = ApiError_NostrUrl;
  const factory ApiError.nostrTag({
    required String message,
  }) = ApiError_NostrTag;
  const factory ApiError.nostrEvent({
    required String message,
  }) = ApiError_NostrEvent;
  const factory ApiError.nostrParse({
    required String message,
  }) = ApiError_NostrParse;
  const factory ApiError.nostrHex({
    required String message,
  }) = ApiError_NostrHex;
  const factory ApiError.loginInvalidKeyFormat({
    required String message,
  }) = ApiError_LoginInvalidKeyFormat;
  const factory ApiError.loginNoRelayConnections() = ApiError_LoginNoRelayConnections;
  const factory ApiError.loginTimeout({
    required String message,
  }) = ApiError_LoginTimeout;
  const factory ApiError.loginNoLoginInProgress() = ApiError_LoginNoLoginInProgress;
  const factory ApiError.loginInternal({
    required String message,
  }) = ApiError_LoginInternal;
  const factory ApiError.loginKeyringUnavailable({
    required String message,
  }) = ApiError_LoginKeyringUnavailable;
  const factory ApiError.other({
    required String message,
  }) = ApiError_Other;

  /// Get a user-friendly error type name
  Future<String> errorType() => RustLib.instance.api.crateApiErrorApiErrorErrorType(
    that: this,
  );

  /// Get the error message as a string
  Future<String> messageText() => RustLib.instance.api.crateApiErrorApiErrorMessageText(
    that: this,
  );
}
