44 lines
1.5 KiB
Dart
44 lines
1.5 KiB
Dart
/// Formule d'abonnement retournée par /api/souscriptions/formules
|
|
class FormuleModel {
|
|
final String code; // BASIC | STANDARD | PREMIUM
|
|
final String libelle;
|
|
final String? description;
|
|
final String plage; // PETITE | MOYENNE | GRANDE | TRES_GRANDE
|
|
final String plageLibelle;
|
|
final int minMembres;
|
|
final int maxMembres; // -1 = illimité
|
|
final double prixMensuel;
|
|
final double prixAnnuel;
|
|
final int ordreAffichage;
|
|
|
|
const FormuleModel({
|
|
required this.code,
|
|
required this.libelle,
|
|
this.description,
|
|
required this.plage,
|
|
required this.plageLibelle,
|
|
required this.minMembres,
|
|
required this.maxMembres,
|
|
required this.prixMensuel,
|
|
required this.prixAnnuel,
|
|
required this.ordreAffichage,
|
|
});
|
|
|
|
factory FormuleModel.fromJson(Map<dynamic, dynamic> json) {
|
|
return FormuleModel(
|
|
code: json['code'] as String,
|
|
libelle: json['libelle'] as String,
|
|
description: json['description'] as String?,
|
|
plage: json['plage'] as String,
|
|
plageLibelle: (json['plageLibelle'] as String?) ?? '',
|
|
minMembres: (json['minMembres'] as num?)?.toInt() ?? 0,
|
|
maxMembres: (json['maxMembres'] as num?)?.toInt() ?? -1,
|
|
prixMensuel: (json['prixMensuel'] as num?)?.toDouble() ?? 0,
|
|
prixAnnuel: (json['prixAnnuel'] as num?)?.toDouble() ?? 0,
|
|
ordreAffichage: (json['ordreAffichage'] as num?)?.toInt() ?? 0,
|
|
);
|
|
}
|
|
|
|
String get maxMembresLabel => maxMembres == -1 ? '∞' : '$maxMembres';
|
|
}
|