import 'package:byod/api/api.dart';
import 'package:byod/models/filter_menu.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class FilterMenuBloc extends Cubit<List<FilterMenu>> {
  FilterMenuBloc() : super([]);

  // Future<List<FilterMenu>> filterMenu(String branchCode, String brandCode,
  //     String role, String cashierName, String tokenUser) async {
  //   var result = await Api.getMenuAndFilterMenu(
  //       branchCode, brandCode, role, cashierName, tokenUser);
  //   return result;
  // }
  Future<List<FilterMenu>> filterMenu(String branchCode, String brandCode,
      String role, String cashierName, String token) async {
    var result = await Api.getMenuAndFilterMenu(
        branchCode, brandCode, role, cashierName, token);
    return result;
  }

  void catAndMenu(String branchCode, String brandCode, String role,
      String cashierName, String token) {
    filterMenu(branchCode, brandCode, role, cashierName, token).then((value) {
      emit(value);
    });
  }
}
