package interfaces.strategytest;

import objects.SoccerMatch;

import java.util.List;
import java.util.stream.Collectors;

public interface BettingStrategyInterface {

    void setMatches(List<SoccerMatch> matches);
    void buildSettingsGuiPanel();

    void buildStatGuiPanel();

    void buildMatchSummaryPanel();

    void runTest();
    String shouldBetOn(SoccerMatch match);

    List<?> sortMatchesOnBetPotential(List<SoccerMatch> matches);

    default float calculate1XOdds(SoccerMatch match) {
        return match.getOddsX() * match.getOdds1() / (match.getOddsX() + match.getOdds1());
    }

    default float calculate1XOdds(float odds1, float oddsX) {
        return oddsX * odds1 / (oddsX + odds1);
    }

    default float calculateX2Odds(SoccerMatch match) {
        return match.getOddsX() * match.getOdds2() / (match.getOddsX() + match.getOdds2());
    }

    default float calculateX2Odds(float oddsX, float odds2) {
        return oddsX * odds2 / (oddsX + odds2);
    }

    default float calculate12Odds(SoccerMatch match) {
        return match.getOdds1() * match.getOdds2() / (match.getOdds1() + match.getOdds2());
    }

    default float calculate12Odds(float odds1, float odds2) {
        return odds1 * odds2 / (odds1 + odds2);
    }

    default float convertPercentageToOdds(float percentage) {
        if (percentage > 1f) {
            return (1f / (percentage / 100));
        }
        return (1f / percentage);
    }

    default float convertOddsToPercentage(float odds) {
        return 1 / (odds + 1f) * 100;
    }

    default float convertOddsToPercentageDecimal(float odds) {
        return 1 / (odds + 1f);
    }

    default List<SoccerMatch> filterTodaysMatches(List<SoccerMatch> matches, SoccerMatch match) {
        return matches.stream()
                .filter(p -> p.getGameDate().toLocalDate().isEqual(match.getGameDate().toLocalDate())).collect(Collectors.toList());
    }

}
