// 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): `clone`, `clone`, `fmt`, `fmt`, `from`, `from`, `from`, `try_from`

Future<MediaFile> uploadChatMedia({
  required String accountPubkey,
  required String groupId,
  required String filePath,
}) => RustLib.instance.api.crateApiMediaFilesUploadChatMedia(
  accountPubkey: accountPubkey,
  groupId: groupId,
  filePath: filePath,
);

Future<MediaFile> downloadChatMedia({
  required String accountPubkey,
  required String groupId,
  required String originalFileHash,
}) => RustLib.instance.api.crateApiMediaFilesDownloadChatMedia(
  accountPubkey: accountPubkey,
  groupId: groupId,
  originalFileHash: originalFileHash,
);

class FileMetadata {
  final String? originalFilename;
  final String? dimensions;
  final String? blurhash;
  final String? thumbhash;
  final BigInt? durationMs;
  final Uint8List? waveform;

  const FileMetadata({
    this.originalFilename,
    this.dimensions,
    this.blurhash,
    this.thumbhash,
    this.durationMs,
    this.waveform,
  });

  @override
  int get hashCode =>
      originalFilename.hashCode ^
      dimensions.hashCode ^
      blurhash.hashCode ^
      thumbhash.hashCode ^
      durationMs.hashCode ^
      waveform.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is FileMetadata &&
          runtimeType == other.runtimeType &&
          originalFilename == other.originalFilename &&
          dimensions == other.dimensions &&
          blurhash == other.blurhash &&
          thumbhash == other.thumbhash &&
          durationMs == other.durationMs &&
          waveform == other.waveform;
}

class MediaFile {
  final String id;
  final String mlsGroupId;
  final String accountPubkey;
  final String filePath;
  final String? originalFileHash;
  final String encryptedFileHash;
  final String mimeType;
  final String mediaType;
  final String blossomUrl;
  final String nostrKey;
  final FileMetadata? fileMetadata;
  final DateTime createdAt;
  final String? nonce;
  final String? schemeVersion;

  const MediaFile({
    required this.id,
    required this.mlsGroupId,
    required this.accountPubkey,
    required this.filePath,
    this.originalFileHash,
    required this.encryptedFileHash,
    required this.mimeType,
    required this.mediaType,
    required this.blossomUrl,
    required this.nostrKey,
    this.fileMetadata,
    required this.createdAt,
    this.nonce,
    this.schemeVersion,
  });

  @override
  int get hashCode =>
      id.hashCode ^
      mlsGroupId.hashCode ^
      accountPubkey.hashCode ^
      filePath.hashCode ^
      originalFileHash.hashCode ^
      encryptedFileHash.hashCode ^
      mimeType.hashCode ^
      mediaType.hashCode ^
      blossomUrl.hashCode ^
      nostrKey.hashCode ^
      fileMetadata.hashCode ^
      createdAt.hashCode ^
      nonce.hashCode ^
      schemeVersion.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is MediaFile &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          mlsGroupId == other.mlsGroupId &&
          accountPubkey == other.accountPubkey &&
          filePath == other.filePath &&
          originalFileHash == other.originalFileHash &&
          encryptedFileHash == other.encryptedFileHash &&
          mimeType == other.mimeType &&
          mediaType == other.mediaType &&
          blossomUrl == other.blossomUrl &&
          nostrKey == other.nostrKey &&
          fileMetadata == other.fileMetadata &&
          createdAt == other.createdAt &&
          nonce == other.nonce &&
          schemeVersion == other.schemeVersion;
}
