Files
unionflow-server-impl-quarkus/unionflow-mobile-apps/lib/features/cotisations/bloc/cotisations_state.dart

173 lines
3.8 KiB
Dart

/// États pour le BLoC des cotisations
library cotisations_state;
import 'package:equatable/equatable.dart';
import '../data/models/cotisation_model.dart';
/// Classe de base pour tous les états de cotisations
abstract class CotisationsState extends Equatable {
const CotisationsState();
@override
List<Object?> get props => [];
}
/// État initial
class CotisationsInitial extends CotisationsState {
const CotisationsInitial();
}
/// État de chargement
class CotisationsLoading extends CotisationsState {
final String? message;
const CotisationsLoading({this.message});
@override
List<Object?> get props => [message];
}
/// État de rafraîchissement
class CotisationsRefreshing extends CotisationsState {
const CotisationsRefreshing();
}
/// État chargé avec succès
class CotisationsLoaded extends CotisationsState {
final List<CotisationModel> cotisations;
final int total;
final int page;
final int size;
final int totalPages;
const CotisationsLoaded({
required this.cotisations,
required this.total,
required this.page,
required this.size,
required this.totalPages,
});
@override
List<Object?> get props => [cotisations, total, page, size, totalPages];
}
/// État détail d'une cotisation chargé
class CotisationDetailLoaded extends CotisationsState {
final CotisationModel cotisation;
const CotisationDetailLoaded({required this.cotisation});
@override
List<Object?> get props => [cotisation];
}
/// État cotisation créée
class CotisationCreated extends CotisationsState {
final CotisationModel cotisation;
const CotisationCreated({required this.cotisation});
@override
List<Object?> get props => [cotisation];
}
/// État cotisation mise à jour
class CotisationUpdated extends CotisationsState {
final CotisationModel cotisation;
const CotisationUpdated({required this.cotisation});
@override
List<Object?> get props => [cotisation];
}
/// État cotisation supprimée
class CotisationDeleted extends CotisationsState {
final String id;
const CotisationDeleted({required this.id});
@override
List<Object?> get props => [id];
}
/// État paiement enregistré
class PaiementEnregistre extends CotisationsState {
final CotisationModel cotisation;
const PaiementEnregistre({required this.cotisation});
@override
List<Object?> get props => [cotisation];
}
/// État statistiques chargées
class CotisationsStatsLoaded extends CotisationsState {
final Map<String, dynamic> stats;
const CotisationsStatsLoaded({required this.stats});
@override
List<Object?> get props => [stats];
}
/// État cotisations générées
class CotisationsGenerees extends CotisationsState {
final int nombreGenere;
const CotisationsGenerees({required this.nombreGenere});
@override
List<Object?> get props => [nombreGenere];
}
/// État rappel envoyé
class RappelEnvoye extends CotisationsState {
final String cotisationId;
const RappelEnvoye({required this.cotisationId});
@override
List<Object?> get props => [cotisationId];
}
/// État d'erreur générique
class CotisationsError extends CotisationsState {
final String message;
final dynamic error;
const CotisationsError({
required this.message,
this.error,
});
@override
List<Object?> get props => [message, error];
}
/// État d'erreur réseau
class CotisationsNetworkError extends CotisationsState {
final String message;
const CotisationsNetworkError({required this.message});
@override
List<Object?> get props => [message];
}
/// État d'erreur de validation
class CotisationsValidationError extends CotisationsState {
final String message;
final Map<String, String>? fieldErrors;
const CotisationsValidationError({
required this.message,
this.fieldErrors,
});
@override
List<Object?> get props => [message, fieldErrors];
}