mirrored_repositories/manga_app/lib/logic/bloc/manga
import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:manga_app/data/models/models.dart';
import 'package:manga_app/data/repository/repository.dart';

part 'schedule_event.dart';
part 'schedule_state.dart';

class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
  ScheduleBloc() : super(ScheduleInitial());

  @override
  Stream<ScheduleState> mapEventToState(ScheduleEvent event) async* {
    if (event is ScheduleLoadEvent) {
      yield ScheduleLoading();
      final scheduleRepo = await AnimeRepository().getAnimeSchedule();
      yield ScheduleLoadedSuccess(mangas: scheduleRepo);
    }
  }
}
