import "package:fast_immutable_collections/fast_immutable_collections.dart"; import "package:freezed_annotation/freezed_annotation.dart"; import "package:nexus/models/content/content.dart"; part "topic.freezed.dart"; part "topic.g.dart"; @Freezed(toJson: false, fromJson: false) @JsonSerializable() class const TopicContent({ required final String topic, @JsonKey(name: "m.topic") final TopicContentBlock? content, }) extends Content with _$TopicContent { @override Map toJson() => _$TopicContentToJson(this); factory TopicContent.fromJson(Map json) => _$TopicContentFromJson(json); } @Freezed(toJson: false, fromJson: false) @JsonSerializable() class const TopicContentBlock({ final IList representations = const .empty(), }) with _$TopicContentBlock { Map toJson() => _$TopicContentBlockToJson(this); factory TopicContentBlock.fromJson(Map json) => _$TopicContentBlockFromJson(json); } @Freezed(toJson: false, fromJson: false) @JsonSerializable() class const TextualRepresentation({ required final String body, final String mimetype = "text/plain", }) with _$TextualRepresentation { Map toJson() => _$TextualRepresentationToJson(this); factory TextualRepresentation.fromJson(Map json) => _$TextualRepresentationFromJson(json); }