270 lines
7.4 KiB
Dart
270 lines
7.4 KiB
Dart
// @dart=2.18
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
// ignore_for_file: constant_identifier_names
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
part of openapi.api;
|
|
|
|
class StatsSummaryDTO {
|
|
StatsSummaryDTO({
|
|
this.totalSessions = 0,
|
|
this.avgVisitDurationSeconds = 0,
|
|
this.topSections = const [],
|
|
this.visitsByDay = const [],
|
|
this.languageDistribution = const {},
|
|
this.appTypeDistribution = const {},
|
|
this.topPois = const [],
|
|
this.topAgendaEvents = const [],
|
|
this.quizStats = const [],
|
|
this.gameStats = const [],
|
|
});
|
|
|
|
int totalSessions;
|
|
int avgVisitDurationSeconds;
|
|
List<SectionStatDTO> topSections;
|
|
List<DayStatDTO> visitsByDay;
|
|
Map<String, int> languageDistribution;
|
|
Map<String, int> appTypeDistribution;
|
|
List<PoiStatDTO> topPois;
|
|
List<AgendaEventStatDTO> topAgendaEvents;
|
|
List<QuizStatDTO> quizStats;
|
|
List<GameStatDTO> gameStats;
|
|
|
|
static StatsSummaryDTO? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
return StatsSummaryDTO(
|
|
totalSessions: mapValueOfType<int>(json, r'totalSessions') ?? 0,
|
|
avgVisitDurationSeconds: mapValueOfType<int>(json, r'avgVisitDurationSeconds') ?? 0,
|
|
topSections: SectionStatDTO.listFromJson(json[r'topSections']),
|
|
visitsByDay: DayStatDTO.listFromJson(json[r'visitsByDay']),
|
|
languageDistribution: (json[r'languageDistribution'] is Map)
|
|
? (json[r'languageDistribution'] as Map).cast<String, int>()
|
|
: {},
|
|
appTypeDistribution: (json[r'appTypeDistribution'] is Map)
|
|
? (json[r'appTypeDistribution'] as Map).cast<String, int>()
|
|
: {},
|
|
topPois: PoiStatDTO.listFromJson(json[r'topPois']),
|
|
topAgendaEvents: AgendaEventStatDTO.listFromJson(json[r'topAgendaEvents']),
|
|
quizStats: QuizStatDTO.listFromJson(json[r'quizStats']),
|
|
gameStats: GameStatDTO.listFromJson(json[r'gameStats']),
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
class SectionStatDTO {
|
|
SectionStatDTO({
|
|
this.sectionId,
|
|
this.sectionTitle,
|
|
this.views = 0,
|
|
this.avgDurationSeconds = 0,
|
|
});
|
|
|
|
String? sectionId;
|
|
String? sectionTitle;
|
|
int views;
|
|
int avgDurationSeconds;
|
|
|
|
static SectionStatDTO? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
return SectionStatDTO(
|
|
sectionId: mapValueOfType<String>(json, r'sectionId'),
|
|
sectionTitle: mapValueOfType<String>(json, r'sectionTitle'),
|
|
views: mapValueOfType<int>(json, r'views') ?? 0,
|
|
avgDurationSeconds: mapValueOfType<int>(json, r'avgDurationSeconds') ?? 0,
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<SectionStatDTO> listFromJson(dynamic json) {
|
|
final result = <SectionStatDTO>[];
|
|
if (json is List) {
|
|
for (final row in json) {
|
|
final value = SectionStatDTO.fromJson(row);
|
|
if (value != null) result.add(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
class DayStatDTO {
|
|
DayStatDTO({
|
|
this.date,
|
|
this.total = 0,
|
|
this.mobile = 0,
|
|
this.tablet = 0,
|
|
});
|
|
|
|
String? date;
|
|
int total;
|
|
int mobile;
|
|
int tablet;
|
|
|
|
static DayStatDTO? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
return DayStatDTO(
|
|
date: mapValueOfType<String>(json, r'date'),
|
|
total: mapValueOfType<int>(json, r'total') ?? 0,
|
|
mobile: mapValueOfType<int>(json, r'mobile') ?? 0,
|
|
tablet: mapValueOfType<int>(json, r'tablet') ?? 0,
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<DayStatDTO> listFromJson(dynamic json) {
|
|
final result = <DayStatDTO>[];
|
|
if (json is List) {
|
|
for (final row in json) {
|
|
final value = DayStatDTO.fromJson(row);
|
|
if (value != null) result.add(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
class PoiStatDTO {
|
|
PoiStatDTO({this.geoPointId, this.title, this.taps = 0, this.sectionId});
|
|
|
|
int? geoPointId;
|
|
String? title;
|
|
int taps;
|
|
String? sectionId;
|
|
|
|
static PoiStatDTO? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
return PoiStatDTO(
|
|
geoPointId: mapValueOfType<int>(json, r'geoPointId'),
|
|
title: mapValueOfType<String>(json, r'title'),
|
|
taps: mapValueOfType<int>(json, r'taps') ?? 0,
|
|
sectionId: mapValueOfType<String>(json, r'sectionId'),
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<PoiStatDTO> listFromJson(dynamic json) {
|
|
final result = <PoiStatDTO>[];
|
|
if (json is List) {
|
|
for (final row in json) {
|
|
final value = PoiStatDTO.fromJson(row);
|
|
if (value != null) result.add(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
class AgendaEventStatDTO {
|
|
AgendaEventStatDTO({this.eventId, this.eventTitle, this.taps = 0});
|
|
|
|
String? eventId;
|
|
String? eventTitle;
|
|
int taps;
|
|
|
|
static AgendaEventStatDTO? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
return AgendaEventStatDTO(
|
|
eventId: mapValueOfType<String>(json, r'eventId'),
|
|
eventTitle: mapValueOfType<String>(json, r'eventTitle'),
|
|
taps: mapValueOfType<int>(json, r'taps') ?? 0,
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<AgendaEventStatDTO> listFromJson(dynamic json) {
|
|
final result = <AgendaEventStatDTO>[];
|
|
if (json is List) {
|
|
for (final row in json) {
|
|
final value = AgendaEventStatDTO.fromJson(row);
|
|
if (value != null) result.add(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
class QuizStatDTO {
|
|
QuizStatDTO({
|
|
this.sectionId,
|
|
this.sectionTitle,
|
|
this.completions = 0,
|
|
this.avgScore = 0,
|
|
this.totalQuestions = 0,
|
|
});
|
|
|
|
String? sectionId;
|
|
String? sectionTitle;
|
|
int completions;
|
|
double avgScore;
|
|
int totalQuestions;
|
|
|
|
static QuizStatDTO? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
return QuizStatDTO(
|
|
sectionId: mapValueOfType<String>(json, r'sectionId'),
|
|
sectionTitle: mapValueOfType<String>(json, r'sectionTitle'),
|
|
completions: mapValueOfType<int>(json, r'completions') ?? 0,
|
|
avgScore: mapValueOfType<double>(json, r'avgScore') ?? 0,
|
|
totalQuestions: mapValueOfType<int>(json, r'totalQuestions') ?? 0,
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<QuizStatDTO> listFromJson(dynamic json) {
|
|
final result = <QuizStatDTO>[];
|
|
if (json is List) {
|
|
for (final row in json) {
|
|
final value = QuizStatDTO.fromJson(row);
|
|
if (value != null) result.add(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
class GameStatDTO {
|
|
GameStatDTO({this.gameType, this.completions = 0, this.avgDurationSeconds = 0});
|
|
|
|
String? gameType;
|
|
int completions;
|
|
int avgDurationSeconds;
|
|
|
|
static GameStatDTO? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
return GameStatDTO(
|
|
gameType: mapValueOfType<String>(json, r'gameType'),
|
|
completions: mapValueOfType<int>(json, r'completions') ?? 0,
|
|
avgDurationSeconds: mapValueOfType<int>(json, r'avgDurationSeconds') ?? 0,
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<GameStatDTO> listFromJson(dynamic json) {
|
|
final result = <GameStatDTO>[];
|
|
if (json is List) {
|
|
for (final row in json) {
|
|
final value = GameStatDTO.fromJson(row);
|
|
if (value != null) result.add(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|