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:betting/view/mobile/favourites_view/teams/team_info_view/team_info_controller.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';

class ResultTeamInfoController extends GetxController {
  var listMatChesFavouriteOfTeamResult = <ItemsMatches>[].obs;
  var outputDateToDateFormat = DateFormat('yyyy-MM-dd');
  MatchesRepo matchesRepo = MatchesRepo();

  @override
  void onInit() {
    getListMatchesOnDayTeam('${Get.find<TeamInfoController>().itemTeam.value.id}', '','FINISHED');
    super.onInit();
  }

  getListMatchesOnDayTeam(String teamId, date, String status) async{
    await matchesRepo.getListMatches(date, '', teamId, status).then((value) {
      if(value.state == Status.SUCCESS){
        listMatChesFavouriteOfTeamResult.value = value.object!;
      }
    },);
    update();
  }

}