// 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 'markdown.freezed.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`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`, `from`

enum MarkdownAlignment {
  none,
  left,
  center,
  right,
}

enum MarkdownAutolinkKind {
  uri,
  email,
}

@freezed
sealed class MarkdownBlock with _$MarkdownBlock {
  const MarkdownBlock._();

  const factory MarkdownBlock.paragraph({
    required List<MarkdownInline> inlines,
  }) = MarkdownBlock_Paragraph;
  const factory MarkdownBlock.heading({
    required int level,
    required List<MarkdownInline> inlines,
  }) = MarkdownBlock_Heading;
  const factory MarkdownBlock.thematicBreak() = MarkdownBlock_ThematicBreak;
  const factory MarkdownBlock.codeBlock({
    required MarkdownCodeBlockKind kind,
    required String info,
    required String content,
  }) = MarkdownBlock_CodeBlock;
  const factory MarkdownBlock.blockQuote({
    required List<MarkdownBlock> blocks,
  }) = MarkdownBlock_BlockQuote;
  const factory MarkdownBlock.list({
    required MarkdownListKind kind,
    required bool tight,
    required List<MarkdownListItem> items,
  }) = MarkdownBlock_List;
  const factory MarkdownBlock.table({
    required List<MarkdownAlignment> alignments,
    required List<MarkdownTableCell> header,
    required List<List<MarkdownTableCell>> rows,
  }) = MarkdownBlock_Table;
  const factory MarkdownBlock.mathBlock({
    required String content,
  }) = MarkdownBlock_MathBlock;
}

enum MarkdownCodeBlockKind {
  indented,
  fenced,
}

class MarkdownDocument {
  final List<MarkdownBlock> blocks;

  const MarkdownDocument({
    required this.blocks,
  });

  @override
  int get hashCode => blocks.hashCode;

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

@freezed
sealed class MarkdownInline with _$MarkdownInline {
  const MarkdownInline._();

  const factory MarkdownInline.text({
    required String content,
  }) = MarkdownInline_Text;
  const factory MarkdownInline.softBreak() = MarkdownInline_SoftBreak;
  const factory MarkdownInline.hardBreak() = MarkdownInline_HardBreak;
  const factory MarkdownInline.code({
    required String content,
  }) = MarkdownInline_Code;
  const factory MarkdownInline.emph({
    required List<MarkdownInline> children,
  }) = MarkdownInline_Emph;
  const factory MarkdownInline.strong({
    required List<MarkdownInline> children,
  }) = MarkdownInline_Strong;
  const factory MarkdownInline.strikethrough({
    required List<MarkdownInline> children,
  }) = MarkdownInline_Strikethrough;
  const factory MarkdownInline.link({
    required String dest,
    String? title,
    required List<MarkdownInline> children,
  }) = MarkdownInline_Link;
  const factory MarkdownInline.image({
    required String dest,
    String? title,
    required List<MarkdownInline> alt,
  }) = MarkdownInline_Image;
  const factory MarkdownInline.autolink({
    required String url,
    required MarkdownAutolinkKind kind,
  }) = MarkdownInline_Autolink;
  const factory MarkdownInline.math({
    required String content,
  }) = MarkdownInline_Math;
  const factory MarkdownInline.nostrMention({
    required MarkdownNostrEntity entity,
  }) = MarkdownInline_NostrMention;
  const factory MarkdownInline.nostrUri({
    required MarkdownNostrEntity entity,
  }) = MarkdownInline_NostrUri;
}

class MarkdownListItem {
  final List<MarkdownBlock> blocks;

  /// `None` for plain bullets/ordered items, `Some(false)` for `[ ]`, `Some(true)` for `[x]`.
  final bool? checked;

  const MarkdownListItem({
    required this.blocks,
    this.checked,
  });

  @override
  int get hashCode => blocks.hashCode ^ checked.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is MarkdownListItem &&
          runtimeType == other.runtimeType &&
          blocks == other.blocks &&
          checked == other.checked;
}

@freezed
sealed class MarkdownListKind with _$MarkdownListKind {
  const MarkdownListKind._();

  /// `marker` is a single-character String: "-", "*", or "+".
  const factory MarkdownListKind.bullet({
    required String marker,
  }) = MarkdownListKind_Bullet;

  /// `delimiter` is a single-character String: "." or ")".
  const factory MarkdownListKind.ordered({
    required int start,
    required String delimiter,
  }) = MarkdownListKind_Ordered;
}

class MarkdownNostrEntity {
  final MarkdownNostrHrp hrp;
  final String bech32;

  const MarkdownNostrEntity({
    required this.hrp,
    required this.bech32,
  });

  @override
  int get hashCode => hrp.hashCode ^ bech32.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is MarkdownNostrEntity &&
          runtimeType == other.runtimeType &&
          hrp == other.hrp &&
          bech32 == other.bech32;
}

enum MarkdownNostrHrp {
  npub,
  note,
  nevent,
  nprofile,
  naddr,
  nrelay,
}

class MarkdownTableCell {
  final List<MarkdownInline> inlines;

  const MarkdownTableCell({
    required this.inlines,
  });

  @override
  int get hashCode => inlines.hashCode;

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