import 'package:bloc/bloc.dart';
import 'package:dio/dio.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
import 'package:hoshan/data/model/effects_model.dart';
import 'package:hoshan/data/repository/bot_repository.dart';

part 'effects_state.dart';

class EffectsCubit extends Cubit<EffectsState> {
  EffectsCubit() : super(EffectsInitial());

  void getAllEffects() async {
    emit(EffectsLoading());
    try {
      final response = await BotRepository.getAllEffects();
      emit(EffectsSuccess(effectsModel: response));
    } on DioException catch (e) {
      emit(EffectsFail());
      if (kDebugMode) {
        print('Dio Error is: $e');
      }
    }
  }
}
