part of 'operation_form_cubit.dart';

enum OperationFormStatus {
  initial,
  loading,
  ready,
  saving,
  success,
  successAndAddAnother, // Nuovo stato in stile Ticket!
  failure,
}

class OperationFormState extends Equatable {
  final OperationFormStatus status;
  final OperationModel operation;
  final String? errorMessage;
  // Teniamo traccia delle operazioni salvate in questa sessione (per UI riepilogo)
  final List<OperationModel> savedBatchOperations;

  const OperationFormState({
    this.status = OperationFormStatus.initial,
    required this.operation,
    this.errorMessage,
    this.savedBatchOperations = const [],
  });

  OperationFormState copyWith({
    OperationFormStatus? status,
    OperationModel? operation,
    String? errorMessage,
    List<OperationModel>? savedBatchOperations,
  }) {
    return OperationFormState(
      status: status ?? this.status,
      operation: operation ?? this.operation,
      errorMessage: errorMessage,
      savedBatchOperations: savedBatchOperations ?? this.savedBatchOperations,
    );
  }

  @override
  List<Object?> get props => [
    status,
    operation,
    errorMessage,
    savedBatchOperations,
  ];
}
