manager-app/manager_api_new/lib/model/instance_dto.dart
Thomas Fransolet bb4d4fe2d5 Écran Statistiques refondu + Guide IA + onboarding (auth, abonnement) + i18n FR/EN/NL
Statistiques — refonte complète, aucun changement backend
  statistics_screen.dart réécrit (+1832) : barres horizontales monochromes à la place
  des barres verticales tronquées et des deux anneaux, barre de filtres unique avec les
  volumes par canal, règle mono-canal, 4 KPI portant chacun leur variation, bandeau
  « à retenir », courbe en aire avec bandes de week-end. La période précédente s'obtient
  en rappelant le même endpoint.
  statistics_report.dart : export PDF généré côté client (paquet pdf Dart), il partage
  les valeurs calculées de l'écran — un chiffre ne peut pas diverger entre l'écran et le
  document envoyé à la commune. Deux puces du sommaire promettaient des données
  inexistantes (parcours terminés, questions au guide IA), retirées.
  ⚠️ Jamais ouvert dans un navigateur. Cases de test : test-plan.md §8bis / §8ter.

Guide IA
  Screens/GuideIa/guide_ia_screen.dart — onglet Configuration. Menu conditionné à
  isAssistant, le même drapeau que la garde d'AiController. L'onglet « Ce que demandent
  vos visiteurs » n'est pas dans ce commit : le schéma backend est prêt, l'UI non.

Onboarding self-service
  Screens/Auth/ (mot de passe oublié, définition du mot de passe),
  Screens/Billing/subscription_screen.dart, ai_quota_hint.dart.
  ⚠️ Aucun parcours joué de bout en bout — test-plan.md §18.

Parcours guidés
  progression_mode.dart : 9 booléens sur 3 niveaux remplacés par 3 questions.
  Popups GuidedPath / GuidedStep / QuizQuestion mises à jour en conséquence.

Client API (manager_api_new) — édité À LA MAIN, ne pas relancer la génération
  onboarding_api.dart, authentication_api.dart (+80), instance_dto (champs Guide*),
  guided_step / quiz_question_guided_step (flags morts retirés).
  Le // @dart=2.18 manquant dans onboarding_api.dart cassait les 3 apps Flutter d'un
  coup — corrigé ici.

i18n : ~180 clés par langue (FR/EN/NL) + fichiers générés.
Tests : progression_mode_test, statistics_report_test (le second a attrapé deux
plantages qui seraient sortis au premier clic).

flutter build web . flutter analyze : 68 erreurs, toutes dans les fichiers modèle
orphelins de manager_api_new — dette connue, pas une régression, ces fichiers ne sont
pas dans le graphe de compilation.
2026-08-09 22:14:37 +02:00

448 lines
15 KiB
Dart

//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @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 InstanceDTO {
/// Returns a new [InstanceDTO] instance.
InstanceDTO({
this.id,
this.name,
this.dateCreation,
this.pinCode,
this.isPushNotification,
this.isMobile,
this.isTablet,
this.isWeb,
this.isVR,
this.isAssistant,
this.guideName,
this.guidePersonaPrompt,
this.guideVoiceId,
this.guideFallbackMessages = const [],
this.subscriptionPlanId,
this.subscriptionPlan,
this.aiTokensThisMonth,
this.aiUsageMonthKey,
this.storageQuotaBytes,
this.aiTokensPerMonth,
this.hasStats,
this.statsHistoryDays,
this.hasAdvancedStats,
this.applicationInstanceDTOs = const [],
this.webSlug,
this.publicApiKey,
this.isTrialActive,
this.trialEndsAt,
});
String? id;
String? name;
DateTime? dateCreation;
String? pinCode;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isPushNotification;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isMobile;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isTablet;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isWeb;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isVR;
bool? isAssistant;
/// Nom du guide affiché au visiteur, libre.
String? guideName;
/// Personnalité du guide : instruction au modèle, jamais affichée au visiteur.
String? guidePersonaPrompt;
/// Voix Gemini TTS : "Sulafat" (Viva) ou "Umbriel" (Marco).
String? guideVoiceId;
/// Formulations de repli. Liste à plat : plusieurs entrées peuvent partager la même langue.
List<TranslationDTO> guideFallbackMessages;
String? subscriptionPlanId;
SubscriptionPlanDTO? subscriptionPlan;
int? aiTokensThisMonth;
String? aiUsageMonthKey;
int? storageQuotaBytes;
int? aiTokensPerMonth;
bool? hasStats;
int? statsHistoryDays;
bool? hasAdvancedStats;
List<ApplicationInstanceDTO>? applicationInstanceDTOs;
String? webSlug;
String? publicApiKey;
bool? isTrialActive;
DateTime? trialEndsAt;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is InstanceDTO &&
other.id == id &&
other.name == name &&
other.dateCreation == dateCreation &&
other.pinCode == pinCode &&
other.isPushNotification == isPushNotification &&
other.isMobile == isMobile &&
other.isTablet == isTablet &&
other.isWeb == isWeb &&
other.isVR == isVR &&
other.isAssistant == isAssistant &&
other.guideName == guideName &&
other.guidePersonaPrompt == guidePersonaPrompt &&
other.guideVoiceId == guideVoiceId &&
_deepEquality.equals(other.guideFallbackMessages, guideFallbackMessages) &&
other.subscriptionPlanId == subscriptionPlanId &&
other.subscriptionPlan == subscriptionPlan &&
other.aiTokensThisMonth == aiTokensThisMonth &&
other.aiUsageMonthKey == aiUsageMonthKey &&
other.storageQuotaBytes == storageQuotaBytes &&
other.aiTokensPerMonth == aiTokensPerMonth &&
other.hasStats == hasStats &&
other.statsHistoryDays == statsHistoryDays &&
other.hasAdvancedStats == hasAdvancedStats &&
_deepEquality.equals(
other.applicationInstanceDTOs, applicationInstanceDTOs);
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(id == null ? 0 : id!.hashCode) +
(name == null ? 0 : name!.hashCode) +
(dateCreation == null ? 0 : dateCreation!.hashCode) +
(pinCode == null ? 0 : pinCode!.hashCode) +
(isPushNotification == null ? 0 : isPushNotification!.hashCode) +
(isMobile == null ? 0 : isMobile!.hashCode) +
(isTablet == null ? 0 : isTablet!.hashCode) +
(isWeb == null ? 0 : isWeb!.hashCode) +
(isVR == null ? 0 : isVR!.hashCode) +
(isAssistant == null ? 0 : isAssistant!.hashCode) +
(guideName == null ? 0 : guideName!.hashCode) +
(guidePersonaPrompt == null ? 0 : guidePersonaPrompt!.hashCode) +
(guideVoiceId == null ? 0 : guideVoiceId!.hashCode) +
(guideFallbackMessages.hashCode) +
(subscriptionPlanId == null ? 0 : subscriptionPlanId!.hashCode) +
(subscriptionPlan == null ? 0 : subscriptionPlan!.hashCode) +
(aiTokensThisMonth == null ? 0 : aiTokensThisMonth!.hashCode) +
(aiUsageMonthKey == null ? 0 : aiUsageMonthKey!.hashCode) +
(applicationInstanceDTOs == null ? 0 : applicationInstanceDTOs!.hashCode);
@override
String toString() =>
'InstanceDTO[id=$id, name=$name, dateCreation=$dateCreation, pinCode=$pinCode, isPushNotification=$isPushNotification, isMobile=$isMobile, isTablet=$isTablet, isWeb=$isWeb, isVR=$isVR, isAssistant=$isAssistant, guideName=$guideName, guideVoiceId=$guideVoiceId, subscriptionPlanId=$subscriptionPlanId, subscriptionPlan=$subscriptionPlan, aiTokensThisMonth=$aiTokensThisMonth, aiUsageMonthKey=$aiUsageMonthKey, applicationInstanceDTOs=$applicationInstanceDTOs]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.id != null) {
json[r'id'] = this.id;
} else {
json[r'id'] = null;
}
if (this.name != null) {
json[r'name'] = this.name;
} else {
json[r'name'] = null;
}
if (this.dateCreation != null) {
json[r'dateCreation'] = this.dateCreation!.toUtc().toIso8601String();
} else {
json[r'dateCreation'] = null;
}
if (this.pinCode != null) {
json[r'pinCode'] = this.pinCode;
} else {
json[r'pinCode'] = null;
}
if (this.isPushNotification != null) {
json[r'isPushNotification'] = this.isPushNotification;
} else {
json[r'isPushNotification'] = null;
}
if (this.isMobile != null) {
json[r'isMobile'] = this.isMobile;
} else {
json[r'isMobile'] = null;
}
if (this.isTablet != null) {
json[r'isTablet'] = this.isTablet;
} else {
json[r'isTablet'] = null;
}
if (this.isWeb != null) {
json[r'isWeb'] = this.isWeb;
} else {
json[r'isWeb'] = null;
}
if (this.isVR != null) {
json[r'isVR'] = this.isVR;
} else {
json[r'isVR'] = null;
}
if (this.isAssistant != null) {
json[r'isAssistant'] = this.isAssistant;
} else {
json[r'isAssistant'] = null;
}
if (this.guideName != null) {
json[r'guideName'] = this.guideName;
} else {
json[r'guideName'] = null;
}
if (this.guidePersonaPrompt != null) {
json[r'guidePersonaPrompt'] = this.guidePersonaPrompt;
} else {
json[r'guidePersonaPrompt'] = null;
}
if (this.guideVoiceId != null) {
json[r'guideVoiceId'] = this.guideVoiceId;
} else {
json[r'guideVoiceId'] = null;
}
json[r'guideFallbackMessages'] = this.guideFallbackMessages;
if (this.subscriptionPlanId != null) {
json[r'subscriptionPlanId'] = this.subscriptionPlanId;
} else {
json[r'subscriptionPlanId'] = null;
}
if (this.subscriptionPlan != null) {
json[r'subscriptionPlan'] = this.subscriptionPlan;
} else {
json[r'subscriptionPlan'] = null;
}
if (this.aiTokensThisMonth != null) {
json[r'aiTokensThisMonth'] = this.aiTokensThisMonth;
} else {
json[r'aiTokensThisMonth'] = null;
}
if (this.aiUsageMonthKey != null) {
json[r'aiUsageMonthKey'] = this.aiUsageMonthKey;
} else {
json[r'aiUsageMonthKey'] = null;
}
if (this.storageQuotaBytes != null) {
json[r'storageQuotaBytes'] = this.storageQuotaBytes;
} else {
json[r'storageQuotaBytes'] = null;
}
if (this.aiTokensPerMonth != null) {
json[r'aiTokensPerMonth'] = this.aiTokensPerMonth;
} else {
json[r'aiTokensPerMonth'] = null;
}
if (this.hasStats != null) {
json[r'hasStats'] = this.hasStats;
} else {
json[r'hasStats'] = null;
}
if (this.statsHistoryDays != null) {
json[r'statsHistoryDays'] = this.statsHistoryDays;
} else {
json[r'statsHistoryDays'] = null;
}
if (this.hasAdvancedStats != null) {
json[r'hasAdvancedStats'] = this.hasAdvancedStats;
} else {
json[r'hasAdvancedStats'] = null;
}
if (this.applicationInstanceDTOs != null) {
json[r'applicationInstanceDTOs'] = this.applicationInstanceDTOs;
} else {
json[r'applicationInstanceDTOs'] = null;
}
if (this.webSlug != null) {
json[r'webSlug'] = this.webSlug;
} else {
json[r'webSlug'] = null;
}
if (this.publicApiKey != null) {
json[r'publicApiKey'] = this.publicApiKey;
} else {
json[r'publicApiKey'] = null;
}
if (this.isTrialActive != null) {
json[r'isTrialActive'] = this.isTrialActive;
} else {
json[r'isTrialActive'] = null;
}
if (this.trialEndsAt != null) {
json[r'trialEndsAt'] = this.trialEndsAt!.toUtc().toIso8601String();
} else {
json[r'trialEndsAt'] = null;
}
return json;
}
/// Returns a new [InstanceDTO] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static InstanceDTO? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key),
'Required key "InstanceDTO[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "InstanceDTO[$key]" has a null value in JSON.');
});
return true;
}());
return InstanceDTO(
id: mapValueOfType<String>(json, r'id'),
name: mapValueOfType<String>(json, r'name'),
dateCreation: mapDateTime(json, r'dateCreation', r''),
pinCode: mapValueOfType<String>(json, r'pinCode'),
isPushNotification: mapValueOfType<bool>(json, r'isPushNotification'),
isMobile: mapValueOfType<bool>(json, r'isMobile'),
isTablet: mapValueOfType<bool>(json, r'isTablet'),
isWeb: mapValueOfType<bool>(json, r'isWeb'),
isVR: mapValueOfType<bool>(json, r'isVR'),
isAssistant: mapValueOfType<bool>(json, r'isAssistant'),
guideName: mapValueOfType<String>(json, r'guideName'),
guidePersonaPrompt: mapValueOfType<String>(json, r'guidePersonaPrompt'),
guideVoiceId: mapValueOfType<String>(json, r'guideVoiceId'),
guideFallbackMessages: TranslationDTO.listFromJson(json[r'guideFallbackMessages']),
subscriptionPlanId: mapValueOfType<String>(json, r'subscriptionPlanId'),
subscriptionPlan: SubscriptionPlanDTO.fromJson(json[r'subscriptionPlan']),
aiTokensThisMonth: mapValueOfType<int>(json, r'aiTokensThisMonth'),
aiUsageMonthKey: mapValueOfType<String>(json, r'aiUsageMonthKey'),
storageQuotaBytes: mapValueOfType<int>(json, r'storageQuotaBytes'),
aiTokensPerMonth: mapValueOfType<int>(json, r'aiTokensPerMonth'),
hasStats: mapValueOfType<bool>(json, r'hasStats'),
statsHistoryDays: mapValueOfType<int>(json, r'statsHistoryDays'),
hasAdvancedStats: mapValueOfType<bool>(json, r'hasAdvancedStats'),
applicationInstanceDTOs: ApplicationInstanceDTO.listFromJson(
json[r'applicationInstanceDTOs']),
webSlug: mapValueOfType<String>(json, r'webSlug'),
publicApiKey: mapValueOfType<String>(json, r'publicApiKey'),
isTrialActive: mapValueOfType<bool>(json, r'isTrialActive'),
trialEndsAt: mapDateTime(json, r'trialEndsAt', r''),
);
}
return null;
}
static List<InstanceDTO> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <InstanceDTO>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = InstanceDTO.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, InstanceDTO> mapFromJson(dynamic json) {
final map = <String, InstanceDTO>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = InstanceDTO.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of InstanceDTO-objects as value to a dart map
static Map<String, List<InstanceDTO>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<InstanceDTO>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = InstanceDTO.listFromJson(
entry.value,
growable: growable,
);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{};
}