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

class StatsMatchesRegionsController extends GetxController{
  var ischaange = 0.obs;
  MatchesRepo matchesRepo = MatchesRepo();
  var itemStats = <Stats>[].obs;
  var itemMatches = Matches().obs;

  List listItemHalf1 = [
    {
      'name':'Shots on target',
      'num1': '1',
      'num2': '9',
    },
    {
      'name':'Shots off target',
      'num1': '4',
      'num2': '11',
    },
    {
      'name':'Blocker shots',
      'num1': '1',
      'num2': '6',
    },
    {
      'name':'Possessions',
      'num1': '23',
      'num2': '45',
    },
    {
      'name':'Corner kicks',
      'num1': '8',
      'num2': '5',
    },
    {
      'name':'Offside',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Fouls',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Throw-ins',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Crosses',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Counter attacks',
      'num1': '13',
      'num2': '5',
    },
    {
      'name':'Goalkeeper saves',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Goals kicks',
      'num1': '3',
      'num2': '5',
    },
  ];
  List listItemHalf2 = [
    {
      'name':'Shots on target',
      'num1': '11',
      'num2': '2',
    },
    {
      'name':'Shots off target',
      'num1': '4',
      'num2': '11',
    },
    {
      'name':'Blocker shots',
      'num1': '1',
      'num2': '6',
    },
    {
      'name':'Possessions',
      'num1': '23',
      'num2': '45',
    },
    {
      'name':'Corner kicks',
      'num1': '8',
      'num2': '5',
    },
    {
      'name':'Offside',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Fouls',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Throw-ins',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Crosses',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Counter attacks',
      'num1': '13',
      'num2': '5',
    },
    {
      'name':'Goalkeeper saves',
      'num1': '3',
      'num2': '5',
    },
    {
      'name':'Goals kicks',
      'num1': '3',
      'num2': '5',
    },
  ];
  @override
  void onInit() {
    itemMatches.value = Get.arguments;
    getStatsMatches(itemMatches.value.sId!);
    super.onInit();
  }


  void getStatsMatches(String matchesId) async {
    await matchesRepo.getStatsMatches(matchesId).then((value) {
      if(value.state == Status.SUCCESS){
        itemStats.value = value.object!;
      }
    },);
  }


}