// // ignore: depend_on_referenced_packages
// import 'package:bloc/bloc.dart';
// import 'package:proxibuy/data/repositories/offer_repository.dart';
// import 'package:proxibuy/presentation/product_detail/bloc/product_detail_event.dart';
// import 'package:proxibuy/presentation/product_detail/bloc/product_detail_state.dart';


// class ProductDetailBloc extends Bloc<ProductDetailEvent, ProductDetailState> {
//   final OfferRepository _offerRepository;

//   ProductDetailBloc({required OfferRepository offerRepository})
//       : _offerRepository = offerRepository,
//         super(ProductDetailInitial()) {
//     on<ProductDetailFetchRequested>(_onFetchRequested);
//   }

//   Future<void> _onFetchRequested(
//     ProductDetailFetchRequested event,
//     Emitter<ProductDetailState> emit,
//   ) async {
//     emit(ProductDetailLoadInProgress());
//     try {
//       final offer = await _offerRepository.fetchOfferById(event.offerId);
//       if (offer != null) {
//         emit(ProductDetailLoadSuccess(offer));
//       } else {
//         emit(const ProductDetailLoadFailure('محصول مورد نظر یافت نشد.'));
//       }
//     } catch (e) {
//       emit(ProductDetailLoadFailure(e.toString()));
//     }
//   }
// }