2020-05-02 09:18:03 +00:00
|
|
|
import 'package:comunic/models/group.dart';
|
|
|
|
|
|
|
|
/// Group membership information
|
|
|
|
///
|
|
|
|
/// @author Pierre Hubert
|
|
|
|
|
|
|
|
class GroupMembership {
|
|
|
|
final int userID;
|
|
|
|
final int groupID;
|
|
|
|
final int timeCreate;
|
|
|
|
final GroupMembershipLevel level;
|
|
|
|
|
|
|
|
const GroupMembership({
|
2022-03-10 18:39:57 +00:00
|
|
|
required this.userID,
|
|
|
|
required this.groupID,
|
|
|
|
required this.timeCreate,
|
|
|
|
required this.level,
|
2020-05-02 09:18:03 +00:00
|
|
|
}) : assert(userID != null),
|
|
|
|
assert(groupID != null),
|
|
|
|
assert(timeCreate != null),
|
|
|
|
assert(level != null);
|
2021-04-25 15:06:28 +00:00
|
|
|
|
|
|
|
String get membershipText => membershipToText(level);
|
2021-04-25 15:49:55 +00:00
|
|
|
|
|
|
|
bool get isAtLeastMember =>
|
|
|
|
level == GroupMembershipLevel.ADMINISTRATOR ||
|
|
|
|
level == GroupMembershipLevel.MODERATOR ||
|
|
|
|
level == GroupMembershipLevel.MEMBER;
|
2021-04-26 06:45:25 +00:00
|
|
|
|
|
|
|
bool get isPending => level == GroupMembershipLevel.PENDING;
|
|
|
|
|
|
|
|
bool get isInvited => level == GroupMembershipLevel.INVITED;
|
2020-05-02 09:18:03 +00:00
|
|
|
}
|