103 lines
2.4 KiB
Dart
103 lines
2.4 KiB
Dart
import 'video_item.dart';
|
||
|
||
enum RadarSessionMode {
|
||
normal,
|
||
discovery,
|
||
learn,
|
||
relax,
|
||
short,
|
||
long,
|
||
}
|
||
|
||
extension RadarSessionModeLabel on RadarSessionMode {
|
||
String get label {
|
||
switch (this) {
|
||
case RadarSessionMode.normal:
|
||
return 'Comme d’habitude';
|
||
case RadarSessionMode.discovery:
|
||
return 'Je veux du nouveau';
|
||
case RadarSessionMode.learn:
|
||
return 'Apprendre';
|
||
case RadarSessionMode.relax:
|
||
return 'Détente';
|
||
case RadarSessionMode.short:
|
||
return 'Courtes vidéos';
|
||
case RadarSessionMode.long:
|
||
return 'Long format';
|
||
}
|
||
}
|
||
|
||
String get shortLabel {
|
||
switch (this) {
|
||
case RadarSessionMode.normal:
|
||
return 'Normal';
|
||
case RadarSessionMode.discovery:
|
||
return 'Découverte';
|
||
case RadarSessionMode.learn:
|
||
return 'Apprendre';
|
||
case RadarSessionMode.relax:
|
||
return 'Détente';
|
||
case RadarSessionMode.short:
|
||
return 'Court';
|
||
case RadarSessionMode.long:
|
||
return 'Long';
|
||
}
|
||
}
|
||
}
|
||
|
||
enum RadarLane {
|
||
forYou,
|
||
continueTopic,
|
||
discovery,
|
||
}
|
||
|
||
class RadarRecommendation {
|
||
const RadarRecommendation({
|
||
required this.video,
|
||
required this.score,
|
||
required this.reasons,
|
||
required this.breakdown,
|
||
required this.lane,
|
||
required this.matchedTerms,
|
||
required this.isNewAuthor,
|
||
});
|
||
|
||
final VideoItem video;
|
||
final int score;
|
||
final List<String> reasons;
|
||
final Map<String, int> breakdown;
|
||
final RadarLane lane;
|
||
final List<String> matchedTerms;
|
||
final bool isNewAuthor;
|
||
}
|
||
|
||
class RadarFeed {
|
||
const RadarFeed({
|
||
required this.mode,
|
||
required this.generatedAt,
|
||
required this.profileTopics,
|
||
required this.primary,
|
||
required this.continueTopic,
|
||
required this.discovery,
|
||
this.categories = const <String, List<RadarRecommendation>>{},
|
||
});
|
||
|
||
final RadarSessionMode mode;
|
||
final DateTime generatedAt;
|
||
final List<String> profileTopics;
|
||
final List<RadarRecommendation> primary;
|
||
final List<RadarRecommendation> continueTopic;
|
||
final List<RadarRecommendation> discovery;
|
||
|
||
/// Primary local classification of proposed videos.
|
||
///
|
||
/// A recommendation belongs to one main category so the category lanes
|
||
/// stay clean and predictable.
|
||
final Map<String, List<RadarRecommendation>> categories;
|
||
|
||
bool get isEmpty =>
|
||
primary.isEmpty &&
|
||
continueTopic.isEmpty &&
|
||
discovery.isEmpty;
|
||
}
|