import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/model/faq.dart';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';

part 'faq_event.dart';
part 'faq_state.dart';

class FaqBloc extends Bloc<FaqEvent, FaqState> {
  List<Faq>? faqs;
  FaqBloc() : super(FaqInitial()) {
    faqs = Cache().getFaqs();
    on<FaqLoad>(_onLoad);
    on<FaqClickDetail>(_onClick);
  }

  void _onLoad(FaqLoad event, Emitter<FaqState> emit) {
    emit(FaqLoading());
    emit(FaqReady());
  }

  void _onClick(FaqClickDetail event, Emitter<FaqState> emit) {
    emit(FaqLoading());
    emit(FaqReady());
  }
}
