Files
workavia-mail-front/model/lib/extensions/presentation_mailbox_extension.dart
T
2022-02-25 06:30:42 +07:00

75 lines
2.0 KiB
Dart

import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
import 'package:model/model.dart';
extension PresentationMailboxExtension on PresentationMailbox {
PresentationMailbox toPresentationMailboxWithMailboxPath(String mailboxPath) {
return PresentationMailbox(
id,
name: name,
parentId: parentId,
role: role,
sortOrder: sortOrder,
totalEmails: totalEmails,
unreadEmails: unreadEmails,
totalThreads: totalThreads,
unreadThreads: unreadThreads,
myRights: myRights,
isSubscribed: isSubscribed,
selectMode: selectMode,
mailboxPath: mailboxPath
);
}
Mailbox toMailbox() {
return Mailbox(
id: id,
name: name,
parentId: parentId,
role: role,
sortOrder: sortOrder,
totalEmails: totalEmails,
unreadEmails: unreadEmails,
totalThreads: totalThreads,
unreadThreads: unreadThreads,
myRights: myRights,
isSubscribed: isSubscribed
);
}
PresentationMailbox toggleSelectPresentationMailbox() {
return PresentationMailbox(
id,
name: name,
parentId: parentId,
role: role,
sortOrder: sortOrder,
totalEmails: totalEmails,
unreadEmails: unreadEmails,
totalThreads: totalThreads,
unreadThreads: unreadThreads,
myRights: myRights,
isSubscribed: isSubscribed,
mailboxPath: mailboxPath,
selectMode: selectMode == SelectMode.INACTIVE ? SelectMode.ACTIVE : SelectMode.INACTIVE,
);
}
PresentationMailbox toSelectedPresentationMailbox({required SelectMode selectMode}) {
return PresentationMailbox(
id,
name: name,
parentId: parentId,
role: role,
sortOrder: sortOrder,
totalEmails: totalEmails,
unreadEmails: unreadEmails,
totalThreads: totalThreads,
unreadThreads: unreadThreads,
myRights: myRights,
isSubscribed: isSubscribed,
mailboxPath: mailboxPath,
selectMode: selectMode,
);
}
}