part of 'refund_form_bloc.dart';

@freezed
class RefundFormState with _$RefundFormState {
  factory RefundFormState({
    required Order order,
    required String reason,
    RefundReason? refundReason,
    required Option<Either<OrderFailure, Unit>> failureOrRefund,
    @Default(false) bool isSubmitting,
    /// Idempotency key untuk refund submission.
    /// Di-generate saat user tap "Refund", dipakai ulang saat retry,
    /// di-clear setelah sukses.
    String? idempotencyKey,
  }) = _RefundFormState;

  factory RefundFormState.initial() => RefundFormState(
    order: Order.empty(),
    reason: '',
    failureOrRefund: none(),
  );
}
