2024-09-16 18:14:23 +00:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
2024-05-18 10:17:16 +00:00
|
|
|
import 'package:solian/models/channel.dart';
|
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
part 'event.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable()
|
2024-06-27 16:05:43 +00:00
|
|
|
class Event {
|
2024-05-18 10:17:16 +00:00
|
|
|
int id;
|
2024-05-26 05:39:21 +00:00
|
|
|
String uuid;
|
2024-05-18 10:17:16 +00:00
|
|
|
DateTime createdAt;
|
|
|
|
DateTime updatedAt;
|
|
|
|
DateTime? deletedAt;
|
2024-06-27 16:05:43 +00:00
|
|
|
Map<String, dynamic> body;
|
2024-05-18 10:17:16 +00:00
|
|
|
String type;
|
|
|
|
Channel? channel;
|
2024-09-07 07:36:06 +00:00
|
|
|
ChannelMember sender;
|
2024-05-18 10:17:16 +00:00
|
|
|
int channelId;
|
|
|
|
int senderId;
|
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
@JsonKey(includeFromJson: false, includeToJson: true)
|
2024-06-27 16:59:11 +00:00
|
|
|
bool isPending = false;
|
2024-05-18 10:17:16 +00:00
|
|
|
|
2024-06-27 16:05:43 +00:00
|
|
|
Event({
|
2024-05-18 10:17:16 +00:00
|
|
|
required this.id,
|
2024-05-26 05:39:21 +00:00
|
|
|
required this.uuid,
|
2024-05-18 10:17:16 +00:00
|
|
|
required this.createdAt,
|
|
|
|
required this.updatedAt,
|
|
|
|
this.deletedAt,
|
2024-06-27 16:05:43 +00:00
|
|
|
required this.body,
|
2024-05-18 10:17:16 +00:00
|
|
|
required this.type,
|
|
|
|
this.channel,
|
|
|
|
required this.sender,
|
|
|
|
required this.channelId,
|
|
|
|
required this.senderId,
|
|
|
|
});
|
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
factory Event.fromJson(Map<String, dynamic> json) => _$EventFromJson(json);
|
2024-05-18 10:17:16 +00:00
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
Map<String, dynamic> toJson() => _$EventToJson(this);
|
2024-05-18 10:17:16 +00:00
|
|
|
}
|
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
@JsonSerializable()
|
2024-06-27 16:05:43 +00:00
|
|
|
class EventMessageBody {
|
2024-09-07 07:36:06 +00:00
|
|
|
@JsonKey(defaultValue: '')
|
2024-06-27 16:05:43 +00:00
|
|
|
String text;
|
2024-09-07 07:36:06 +00:00
|
|
|
@JsonKey(defaultValue: 'plain')
|
2024-06-27 16:05:43 +00:00
|
|
|
String algorithm;
|
2024-08-18 17:35:38 +00:00
|
|
|
List<String>? attachments;
|
2024-06-27 16:05:43 +00:00
|
|
|
int? quoteEvent;
|
|
|
|
int? relatedEvent;
|
|
|
|
List<int>? relatedUsers;
|
|
|
|
|
|
|
|
EventMessageBody({
|
|
|
|
required this.text,
|
|
|
|
required this.algorithm,
|
|
|
|
required this.attachments,
|
|
|
|
required this.quoteEvent,
|
|
|
|
required this.relatedEvent,
|
|
|
|
required this.relatedUsers,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory EventMessageBody.fromJson(Map<String, dynamic> json) =>
|
2024-09-07 07:36:06 +00:00
|
|
|
_$EventMessageBodyFromJson(json);
|
2024-05-18 10:17:16 +00:00
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
Map<String, dynamic> toJson() => _$EventMessageBodyToJson(this);
|
2024-05-18 10:17:16 +00:00
|
|
|
}
|