relatica/lib/models/TimelineIdentifiers.dart
2022-11-29 15:33:16 +00:00

45 lines
1.1 KiB
Dart

enum TimelineType {
home,
global,
local,
tag,
profile,
self,
}
class TimelineIdentifiers {
final TimelineType timeline;
final String auxData;
TimelineIdentifiers({required this.timeline, this.auxData = ''});
String toHumanKey() {
return auxData.isEmpty ? timeline.name : '${timeline.name}_$auxData';
}
factory TimelineIdentifiers.home() =>
TimelineIdentifiers(timeline: TimelineType.home);
factory TimelineIdentifiers.profile(String profileId) => TimelineIdentifiers(
timeline: TimelineType.profile,
auxData: profileId,
);
@override
String toString() {
return auxData.isEmpty
? 'TimelineIdentifiers{timeline: $timeline)'
: 'TimelineIdentifiers{timeline: $timeline, auxData: $auxData}';
}
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is TimelineIdentifiers &&
runtimeType == other.runtimeType &&
timeline == other.timeline &&
auxData == other.auxData;
@override
int get hashCode => timeline.hashCode ^ auxData.hashCode;
}