import 'package:bloc/bloc.dart';
import 'package:easycook_mobile/models/home.dart';
import 'package:easycook_mobile/repositories/explore_repositories.dart';
import 'package:equatable/equatable.dart';

part 'explore_state.dart';

class ExploreCubit extends Cubit<ExploreState> {
  ExploreCubit() : super(ExploreInitial());

  final ExploreRepositories _explore = ExploreRepositories();

  Future<void> fetchExplore() async {
    emit(ExploreLoading());
    try {
      final response = await _explore.getRecipe();
      emit(ExploreSuccess(response.data));
    } catch (error) {
      emit(ExploreFailure(message: error.toString()));
    }
  }
}
