/// États pour le BLoC des approbations
library approval_state;

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

abstract class ApprovalState extends Equatable {
  const ApprovalState();

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

/// État initial
class ApprovalInitial extends ApprovalState {
  const ApprovalInitial();
}

/// Chargement en cours
class ApprovalsLoading extends ApprovalState {
  const ApprovalsLoading();
}

/// Approbations chargées
class ApprovalsLoaded extends ApprovalState {
  final List<TransactionApproval> approvals;
  final int pendingCount;

  const ApprovalsLoaded({
    required this.approvals,
    required this.pendingCount,
  });

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

/// Approbation spécifique chargée
class ApprovalDetailLoaded extends ApprovalState {
  final TransactionApproval approval;

  const ApprovalDetailLoaded(this.approval);

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

/// Transaction approuvée avec succès
class TransactionApproved extends ApprovalState {
  final TransactionApproval approval;
  final String message;

  const TransactionApproved({
    required this.approval,
    this.message = 'Transaction approuvée avec succès',
  });

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

/// Transaction rejetée avec succès
class TransactionRejected extends ApprovalState {
  final TransactionApproval approval;
  final String message;

  const TransactionRejected({
    required this.approval,
    this.message = 'Transaction rejetée avec succès',
  });

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

/// Action en cours (approve/reject)
class ApprovalActionInProgress extends ApprovalState {
  final String actionType; // 'approve' or 'reject'

  const ApprovalActionInProgress(this.actionType);

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

/// Erreur
class ApprovalError extends ApprovalState {
  final String message;

  const ApprovalError(this.message);

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

/// Liste vide
class ApprovalsEmpty extends ApprovalState {
  final String message;

  const ApprovalsEmpty({
    this.message = 'Aucune approbation en attente',
  });

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