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 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 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 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 get props => [numeroReference]; } /// Événement pour créer une nouvelle cotisation class CreateCotisation extends CotisationsEvent { final CotisationModel cotisation; const CreateCotisation(this.cotisation); @override List 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 get props => [id, cotisation]; } /// Événement pour supprimer une cotisation class DeleteCotisation extends CotisationsEvent { final String id; const DeleteCotisation(this.id); @override List 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 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 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 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 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 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 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 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 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 get props => [paymentId, cotisationId]; } /// Événement pour programmer des notifications class ScheduleNotifications extends CotisationsEvent { final List cotisations; const ScheduleNotifications(this.cotisations); @override List get props => [cotisations]; } /// Événement pour synchroniser avec le serveur class SyncWithServer extends CotisationsEvent { final bool forceSync; const SyncWithServer({this.forceSync = false}); @override List get props => [forceSync]; } /// Événement pour appliquer des filtres avancés class ApplyAdvancedFilters extends CotisationsEvent { final Map filters; const ApplyAdvancedFilters(this.filters); @override List get props => [filters]; } /// Événement pour exporter des données class ExportCotisations extends CotisationsEvent { final String format; // 'pdf', 'excel', 'csv' final List? cotisations; const ExportCotisations(this.format, {this.cotisations}); @override List get props => [format, cotisations]; }