/// États pour le BLoC des budgets
library budget_state;

import 'package:equatable/equatable.dart';
import '../../domain/entities/budget.dart';

abstract class BudgetState extends Equatable {
  const BudgetState();

  @override
  List<Object?> get props => [];
}

/// État initial
class BudgetInitial extends BudgetState {
  const BudgetInitial();
}

/// Chargement en cours
class BudgetsLoading extends BudgetState {
  const BudgetsLoading();
}

/// Budgets chargés
class BudgetsLoaded extends BudgetState {
  final List<Budget> budgets;
  final BudgetStatus? filterStatus;
  final int? filterYear;

  const BudgetsLoaded({
    required this.budgets,
    this.filterStatus,
    this.filterYear,
  });

  @override
  List<Object?> get props => [budgets, filterStatus, filterYear];
}

/// Budget spécifique chargé
class BudgetDetailLoaded extends BudgetState {
  final Budget budget;

  const BudgetDetailLoaded(this.budget);

  @override
  List<Object?> get props => [budget];
}

/// Suivi budgétaire chargé
class BudgetTrackingLoaded extends BudgetState {
  final Budget budget;
  final Map<String, dynamic> tracking;

  const BudgetTrackingLoaded({
    required this.budget,
    required this.tracking,
  });

  @override
  List<Object?> get props => [budget, tracking];
}

/// Budget créé avec succès
class BudgetCreated extends BudgetState {
  final Budget budget;
  final String message;

  const BudgetCreated({
    required this.budget,
    this.message = 'Budget créé avec succès',
  });

  @override
  List<Object?> get props => [budget, message];
}

/// Action en cours (create, update)
class BudgetActionInProgress extends BudgetState {
  final String actionType;

  const BudgetActionInProgress(this.actionType);

  @override
  List<Object?> get props => [actionType];
}

/// Erreur
class BudgetError extends BudgetState {
  final String message;

  const BudgetError(this.message);

  @override
  List<Object?> get props => [message];
}

/// Liste vide
class BudgetsEmpty extends BudgetState {
  final String message;

  const BudgetsEmpty({
    this.message = 'Aucun budget trouvé',
  });

  @override
  List<Object?> get props => [message];
}
