import 'package:betting/data/base_service/api_response.dart';
import 'package:betting/data/model/res/matches/matches.dart';
import 'package:betting/data/repository/matches/matches_repo.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';

class FixturesController extends GetxController {
  MatchesRepo matchesRepo = MatchesRepo();
  var listMatChesFavourite = <ItemsMatches>[].obs;
  RxBool isLoading = false.obs;
  var outputTimeFormat = DateFormat('HH:mm');
  var outputDateFormat = DateFormat('dd/MM/yyyy');

  @override
  void onInit() {
    getListMatchesOnTeamFavourite();
    super.onInit();
  }

  getListMatchesOnTeamFavourite() async {
    await matchesRepo.getListMatchesFavourites('INIT').then(
      (value) {
        if (value.state == Status.SUCCESS) {
          listMatChesFavourite.value = value.object!;
        }
      },
    );
    isLoading.value = true;
    update();
  }
}
