package tests.objects;

import objects.SoccerMatch;
import objects.SoccerMatchAnalysis;

import java.util.HashMap;
import java.util.Map;

public class XBestGamesDTO {

    SoccerMatch match;

    private int maxLookback = 15;

    private int minLookback = 1;

    Map<Integer, Values> valuesMap = new HashMap<>();
    private GamePercentages percenage;

    public XBestGamesDTO() {
    }

    public XBestGamesDTO(int min, int max) {
        minLookback = min;
        maxLookback = max;
    }

    public SoccerMatch getMatch() {
        return match;
    }

    public void setMatch(SoccerMatch match) {
        this.match = match;
    }

    public Map<Integer, Values> getValuesMap() {
        return valuesMap;
    }

    public void calculateAllData(SoccerMatchAnalysis sma) {
        for (int i = minLookback; i <= maxLookback; i++) {

            valuesMap.put(i, new Values(
                    sma.winLossRatio(i, true),
                    sma.winLossRatio(i, false),

                    sma.winLossRatioHomeAndAway(i, true),
                    sma.winLossRatioHomeAndAway(i, false),

                    sma.scoringTotal(i, true),
                    sma.scoringTotal(i, false),

                    sma.getScoringDiffLastGames(i)));
        }
    }

    public void setPercentages(GamePercentages percenages) {
        this.percenage = percenages;
    }

    public GamePercentages getPercenage() {
        return percenage;
    }

    public static class Values {
        int homeWinLossRatio;
        int awayWinLossRatio;
        int homeWinLossRatioHomeAndAway;
        int awayWinLossRatioHomeAndAway;
        int homeScoringTotal;
        int awayScoringTotal;
        int scoringDiffLastGames;

        public Values() {
        }

        public Values(int homeWinLossRatio, int awayWinLossRatio, int homeWinLossRatioHomeAndAway, int awayWinLossRatioHomeAndAway, int homeScoringTotal, int awayScoringTotal, int scoringDiffLastGames) {
            this.homeWinLossRatio = homeWinLossRatio;
            this.awayWinLossRatio = awayWinLossRatio;
            this.homeWinLossRatioHomeAndAway = homeWinLossRatioHomeAndAway;
            this.awayWinLossRatioHomeAndAway = awayWinLossRatioHomeAndAway;
            this.homeScoringTotal = homeScoringTotal;
            this.awayScoringTotal = awayScoringTotal;
            this.scoringDiffLastGames = scoringDiffLastGames;
        }

        public int getHomeWinLossRatio() {
            return homeWinLossRatio;
        }

        public int getAwayWinLossRatio() {
            return awayWinLossRatio;
        }

        public int getHomeWinLossRatioHomeAndAway() {
            return homeWinLossRatioHomeAndAway;
        }

        public int getAwayWinLossRatioHomeAndAway() {
            return awayWinLossRatioHomeAndAway;
        }

        public int getHomeScoringTotal() {
            return homeScoringTotal;
        }

        public int getAwayScoringTotal() {
            return awayScoringTotal;
        }

        public int getScoringDiffLastGames() {
            return scoringDiffLastGames;
        }
    }
}
