// ignore: depend_on_referenced_packages
import 'package:bloc/bloc.dart';
import 'package:proxibuy/presentation/offer/bloc/offer_event.dart';
import 'package:proxibuy/presentation/offer/bloc/offer_state.dart';

class OffersBloc extends Bloc<OffersEvent, OffersState> {
  OffersBloc() : super(OffersInitial()) {
    on<OffersReceivedFromMqtt>(_onOffersReceivedFromMqtt);
    on<ClearOffers>(_onClearOffers);
  }

  void _onOffersReceivedFromMqtt(
    OffersReceivedFromMqtt event,
    Emitter<OffersState> emit,
  ) {
    emit(OffersLoadSuccess(event.offers));
  }
  void _onClearOffers(ClearOffers event, Emitter<OffersState> emit) {
    emit(OffersInitial());
  }
}