2023-10-03 13:00:59 -04:00
|
|
|
import 'package:recon/models/session.dart';
|
2023-10-01 15:14:38 -04:00
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
class SessionMetadata {
|
|
|
|
final String sessionHash;
|
|
|
|
final SessionAccessLevel accessLevel;
|
|
|
|
final bool sessionHidden;
|
|
|
|
final bool? isHost;
|
|
|
|
final String? broadcastKey;
|
|
|
|
|
|
|
|
SessionMetadata({
|
|
|
|
required this.sessionHash,
|
|
|
|
required this.accessLevel,
|
|
|
|
required this.sessionHidden,
|
|
|
|
required this.isHost,
|
|
|
|
required this.broadcastKey,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory SessionMetadata.fromMap(Map map) {
|
|
|
|
return SessionMetadata(
|
|
|
|
sessionHash: map["sessionHash"],
|
|
|
|
accessLevel: SessionAccessLevel.fromName(map["accessLevel"]),
|
|
|
|
sessionHidden: map["sessionHidden"],
|
|
|
|
isHost: map["ishost"],
|
|
|
|
broadcastKey: map["broadcastKey"],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map toMap() {
|
|
|
|
return {
|
|
|
|
"sessionHash": sessionHash,
|
|
|
|
"accessLevel": toBeginningOfSentenceCase(accessLevel.name),
|
|
|
|
"sessionHidden": sessionHidden,
|
|
|
|
"isHost": isHost,
|
|
|
|
"broadcastKey": broadcastKey,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|