Files
unionflow-server-impl-quarkus/unionflow-mobile-apps/lib/features/cotisations/presentation/bloc/cotisations_event.dart
2025-09-15 20:15:34 +00:00

301 lines
6.8 KiB
Dart

import 'package:equatable/equatable.dart';
import '../../../../core/models/cotisation_model.dart';
/// Événements du BLoC des cotisations
abstract class CotisationsEvent extends Equatable {
const CotisationsEvent();
@override
List<Object?> get props => [];
}
/// Événement pour charger la liste des cotisations
class LoadCotisations extends CotisationsEvent {
final int page;
final int size;
final bool refresh;
const LoadCotisations({
this.page = 0,
this.size = 20,
this.refresh = false,
});
@override
List<Object?> get props => [page, size, refresh];
}
/// Événement pour charger une cotisation par ID
class LoadCotisationById extends CotisationsEvent {
final String id;
const LoadCotisationById(this.id);
@override
List<Object?> get props => [id];
}
/// Événement pour charger une cotisation par référence
class LoadCotisationByReference extends CotisationsEvent {
final String numeroReference;
const LoadCotisationByReference(this.numeroReference);
@override
List<Object?> get props => [numeroReference];
}
/// Événement pour créer une nouvelle cotisation
class CreateCotisation extends CotisationsEvent {
final CotisationModel cotisation;
const CreateCotisation(this.cotisation);
@override
List<Object?> get props => [cotisation];
}
/// Événement pour mettre à jour une cotisation
class UpdateCotisation extends CotisationsEvent {
final String id;
final CotisationModel cotisation;
const UpdateCotisation(this.id, this.cotisation);
@override
List<Object?> get props => [id, cotisation];
}
/// Événement pour supprimer une cotisation
class DeleteCotisation extends CotisationsEvent {
final String id;
const DeleteCotisation(this.id);
@override
List<Object?> get props => [id];
}
/// Événement pour charger les cotisations d'un membre
class LoadCotisationsByMembre extends CotisationsEvent {
final String membreId;
final int page;
final int size;
final bool refresh;
const LoadCotisationsByMembre(
this.membreId, {
this.page = 0,
this.size = 20,
this.refresh = false,
});
@override
List<Object?> get props => [membreId, page, size, refresh];
}
/// Événement pour charger les cotisations par statut
class LoadCotisationsByStatut extends CotisationsEvent {
final String statut;
final int page;
final int size;
final bool refresh;
const LoadCotisationsByStatut(
this.statut, {
this.page = 0,
this.size = 20,
this.refresh = false,
});
@override
List<Object?> get props => [statut, page, size, refresh];
}
/// Événement pour charger les cotisations en retard
class LoadCotisationsEnRetard extends CotisationsEvent {
final int page;
final int size;
final bool refresh;
const LoadCotisationsEnRetard({
this.page = 0,
this.size = 20,
this.refresh = false,
});
@override
List<Object?> get props => [page, size, refresh];
}
/// Événement pour rechercher des cotisations
class SearchCotisations extends CotisationsEvent {
final String? membreId;
final String? statut;
final String? typeCotisation;
final int? annee;
final int? mois;
final int page;
final int size;
final bool refresh;
const SearchCotisations({
this.membreId,
this.statut,
this.typeCotisation,
this.annee,
this.mois,
this.page = 0,
this.size = 20,
this.refresh = false,
});
@override
List<Object?> get props => [
membreId,
statut,
typeCotisation,
annee,
mois,
page,
size,
refresh,
];
}
/// Événement pour charger les statistiques
class LoadCotisationsStats extends CotisationsEvent {
const LoadCotisationsStats();
}
/// Événement pour rafraîchir les données
class RefreshCotisations extends CotisationsEvent {
const RefreshCotisations();
}
/// Événement pour réinitialiser l'état
class ResetCotisationsState extends CotisationsEvent {
const ResetCotisationsState();
}
/// Événement pour filtrer les cotisations localement
class FilterCotisations extends CotisationsEvent {
final String? searchQuery;
final String? statutFilter;
final String? typeFilter;
const FilterCotisations({
this.searchQuery,
this.statutFilter,
this.typeFilter,
});
@override
List<Object?> get props => [searchQuery, statutFilter, typeFilter];
}
/// Événement pour trier les cotisations
class SortCotisations extends CotisationsEvent {
final String sortBy; // 'dateEcheance', 'montantDu', 'statut', etc.
final bool ascending;
const SortCotisations(this.sortBy, {this.ascending = true});
@override
List<Object?> get props => [sortBy, ascending];
}
/// Événement pour initier un paiement
class InitiatePayment extends CotisationsEvent {
final String cotisationId;
final double montant;
final String methodePaiement;
final String numeroTelephone;
final String? nomPayeur;
final String? emailPayeur;
const InitiatePayment({
required this.cotisationId,
required this.montant,
required this.methodePaiement,
required this.numeroTelephone,
this.nomPayeur,
this.emailPayeur,
});
@override
List<Object?> get props => [
cotisationId,
montant,
methodePaiement,
numeroTelephone,
nomPayeur,
emailPayeur,
];
}
/// Événement pour vérifier le statut d'un paiement
class CheckPaymentStatus extends CotisationsEvent {
final String paymentId;
const CheckPaymentStatus(this.paymentId);
@override
List<Object?> get props => [paymentId];
}
/// Événement pour annuler un paiement
class CancelPayment extends CotisationsEvent {
final String paymentId;
final String cotisationId;
const CancelPayment({
required this.paymentId,
required this.cotisationId,
});
@override
List<Object?> get props => [paymentId, cotisationId];
}
/// Événement pour programmer des notifications
class ScheduleNotifications extends CotisationsEvent {
final List<CotisationModel> cotisations;
const ScheduleNotifications(this.cotisations);
@override
List<Object?> get props => [cotisations];
}
/// Événement pour synchroniser avec le serveur
class SyncWithServer extends CotisationsEvent {
final bool forceSync;
const SyncWithServer({this.forceSync = false});
@override
List<Object?> get props => [forceSync];
}
/// Événement pour appliquer des filtres avancés
class ApplyAdvancedFilters extends CotisationsEvent {
final Map<String, dynamic> filters;
const ApplyAdvancedFilters(this.filters);
@override
List<Object?> get props => [filters];
}
/// Événement pour exporter des données
class ExportCotisations extends CotisationsEvent {
final String format; // 'pdf', 'excel', 'csv'
final List<CotisationModel>? cotisations;
const ExportCotisations(this.format, {this.cotisations});
@override
List<Object?> get props => [format, cotisations];
}