2024-07-26 16:20:11 +00:00
|
|
|
import 'package:solian/models/account.dart';
|
|
|
|
|
2024-05-18 10:17:16 +00:00
|
|
|
class Attachment {
|
|
|
|
int id;
|
|
|
|
DateTime createdAt;
|
|
|
|
DateTime updatedAt;
|
2024-07-25 17:16:32 +00:00
|
|
|
DateTime? deletedAt;
|
2024-05-18 10:17:16 +00:00
|
|
|
String uuid;
|
|
|
|
int size;
|
|
|
|
String name;
|
|
|
|
String alt;
|
|
|
|
String usage;
|
|
|
|
String mimetype;
|
|
|
|
String hash;
|
|
|
|
String destination;
|
|
|
|
Map<String, dynamic>? metadata;
|
|
|
|
bool isMature;
|
2024-07-26 16:20:11 +00:00
|
|
|
Account? account;
|
|
|
|
int? accountId;
|
2024-05-18 10:17:16 +00:00
|
|
|
|
|
|
|
Attachment({
|
|
|
|
required this.id,
|
|
|
|
required this.createdAt,
|
|
|
|
required this.updatedAt,
|
|
|
|
required this.deletedAt,
|
|
|
|
required this.uuid,
|
|
|
|
required this.size,
|
|
|
|
required this.name,
|
|
|
|
required this.alt,
|
|
|
|
required this.usage,
|
|
|
|
required this.mimetype,
|
|
|
|
required this.hash,
|
|
|
|
required this.destination,
|
|
|
|
required this.metadata,
|
|
|
|
required this.isMature,
|
2024-07-26 16:20:11 +00:00
|
|
|
required this.account,
|
2024-05-18 10:17:16 +00:00
|
|
|
required this.accountId,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
|
2024-06-23 10:51:49 +00:00
|
|
|
id: json['id'],
|
|
|
|
createdAt: DateTime.parse(json['created_at']),
|
|
|
|
updatedAt: DateTime.parse(json['updated_at']),
|
2024-07-25 17:16:32 +00:00
|
|
|
deletedAt: json['deleted_at'] != null ? DateTime.parse(json['deleted_at']) : null,
|
2024-06-23 10:51:49 +00:00
|
|
|
uuid: json['uuid'],
|
|
|
|
size: json['size'],
|
|
|
|
name: json['name'],
|
|
|
|
alt: json['alt'],
|
|
|
|
usage: json['usage'],
|
|
|
|
mimetype: json['mimetype'],
|
|
|
|
hash: json['hash'],
|
|
|
|
destination: json['destination'],
|
|
|
|
metadata: json['metadata'],
|
|
|
|
isMature: json['is_mature'],
|
2024-07-26 16:20:11 +00:00
|
|
|
account: json['account'] != null ? Account.fromJson(json['account']) : null,
|
2024-06-23 10:51:49 +00:00
|
|
|
accountId: json['account_id'],
|
2024-05-18 10:17:16 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
2024-06-23 10:51:49 +00:00
|
|
|
'id': id,
|
|
|
|
'created_at': createdAt.toIso8601String(),
|
|
|
|
'updated_at': updatedAt.toIso8601String(),
|
2024-07-25 17:16:32 +00:00
|
|
|
'deleted_at': deletedAt?.toIso8601String(),
|
2024-06-23 10:51:49 +00:00
|
|
|
'uuid': uuid,
|
|
|
|
'size': size,
|
|
|
|
'name': name,
|
|
|
|
'alt': alt,
|
|
|
|
'usage': usage,
|
|
|
|
'mimetype': mimetype,
|
|
|
|
'hash': hash,
|
|
|
|
'destination': destination,
|
|
|
|
'metadata': metadata,
|
|
|
|
'is_mature': isMature,
|
2024-07-26 16:20:11 +00:00
|
|
|
'account': account?.toJson(),
|
2024-06-23 10:51:49 +00:00
|
|
|
'account_id': accountId,
|
2024-05-18 10:17:16 +00:00
|
|
|
};
|
|
|
|
}
|