1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +00:00
comunicmobile/lib/models/post.dart

72 lines
1.9 KiB
Dart

import 'package:comunic/enums/post_kind.dart';
import 'package:comunic/enums/post_visibility_level.dart';
import 'package:comunic/enums/user_access_levels.dart';
import 'package:comunic/lists/comments_list.dart';
import 'package:meta/meta.dart';
/// Single post information
///
/// @author Pierre HUBERT
class Post {
final int id;
final int userID;
final int userPageID;
final int groupID;
final int timeSent;
final String content;
final PostVisibilityLevel visibilityLevel;
final PostKind kind;
final int fileSize;
final String fileType;
final String filePath;
final String fileURL;
final int timeEnd;
final String linkURL;
final String linkTitle;
final String linkDescription;
final String linkImage;
int likes;
bool userLikes;
final UserAccessLevels access;
final CommentsList comments;
Post({
@required this.id,
@required this.userID,
@required this.userPageID,
@required this.groupID,
@required this.timeSent,
@required this.content,
@required this.visibilityLevel,
@required this.kind,
@required this.fileSize,
@required this.fileType,
@required this.filePath,
@required this.fileURL,
@required this.timeEnd,
@required this.linkURL,
@required this.linkTitle,
@required this.linkDescription,
@required this.linkImage,
@required this.likes,
@required this.userLikes,
@required this.access,
@required this.comments
}) : assert(id != null),
assert(userID != null),
assert(userPageID != 0 || groupID != 0),
assert(timeSent != null),
assert(kind != PostKind.TEXT || content != null),
assert(visibilityLevel != null),
assert(kind != null),
assert(kind != PostKind.COUNTDOWN || timeEnd != null),
assert(likes != null),
assert(userLikes != null),
assert(access != null);
bool get hasContent => content != null;
bool get hasComments => comments != null;
}