package objects;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import objects.bets.Bet;

public class SoccerMatch {

    private LocalDateTime gameDate;
    private Team homeTeam;
    private Team awayTeam;

    private int matchId;
    private int homeScore; // Actual Result home
    private int awayScore; // Actual Result away
    private String season;
    private boolean countryPrio;

    private String homeTeamName;
    private String awayTeamName;
    private float odds1;
    private float oddsX;
    private float odds2;
    private BigDecimal goalsHome;
    private BigDecimal goalsAway;
    private BigDecimal goalsDiff;
    private float avgScoreHome;
    private float avgScoreAway;
    private float avgConcededHome;
    private float avgConcededAway;
    private String leagueName;
    private String countryName;
    private String homeWin;
    private String draw;
    private String awayWin;
    private Float scoringScore;
    private Float ownOdds;
    private Float givenOdds;
    private Float percentageToBet;
    private boolean addToBetSlip;
    private Float betAmount;
    private float roundedDiff;
    private float drawPercentage;
    private String analysisValue;
    private Bet bet;

    public SoccerMatch() {
    }

    public void setMatchData(SoccerMatch match) {
        this.matchId = match.getMatchId();
        this.homeTeam = match.getHomeTeam();
        this.awayTeam = match.getAwayTeam();
        this.odds1 = match.getOdds1();
        this.oddsX = match.getOddsX();
        this.odds2 = match.getOdds2();
        this.homeScore = match.getHomeScore();
        this.awayScore = match.getAwayScore();
        this.gameDate = match.getGameDate();
        this.season = match.getSeason();
        this.homeTeamName = homeTeam.getTeamName();
        this.awayTeamName = awayTeam.getTeamName();
    }

    public SoccerMatch(int id, Team homeTeam, Team awayTeam, float odds1, float oddsX, float odds2, int homeScore,
                       int awayScore,
                       LocalDateTime gameDate, String season) {
        this.matchId = id;
        this.homeTeam = homeTeam;
        this.awayTeam = awayTeam;
        this.odds1 = odds1;
        this.oddsX = oddsX;
        this.odds2 = odds2;
        this.homeScore = homeScore;
        this.awayScore = awayScore;
        this.gameDate = gameDate;
        this.season = season;
        this.homeTeamName = homeTeam.getTeamName();
        this.awayTeamName = awayTeam.getTeamName();
    }

    public Team getHomeTeam() {
        return homeTeam;
    }

    public Team getAwayTeam() {
        return awayTeam;
    }

    public int getMatchId() {
        return matchId;
    }

    public int getHomeScore() {
        return homeScore;
    }

    public int getAwayScore() {
        return awayScore;
    }

    public float getOdds1() {
        return odds1;
    }

    public float getOddsX() {
        return oddsX;
    }

    public float getOdds2() {
        return odds2;
    }

    public BigDecimal getGoalsHome() {
        return goalsHome;
    }

    public void setGoalsHome(BigDecimal goalsHome) {
        this.goalsHome = goalsHome;
    }

    public BigDecimal getGoalsAway() {
        return goalsAway;
    }

    public void setGoalsAway(BigDecimal goalsAway) {
        this.goalsAway = goalsAway;
    }

    public BigDecimal getGoalsDiff() {
        return goalsDiff;
    }

    public void setGoalsDiff(BigDecimal goalsDiff) {
        this.goalsDiff = goalsDiff;
    }

    public float getAvgScoreHome() {
        return avgScoreHome;
    }

    public void setAvgScoreHome(float avgScoreHome) {
        this.avgScoreHome = avgScoreHome;
    }

    public float getAvgScoreAway() {
        return avgScoreAway;
    }

    public void setAvgScoreAway(float avgScoreAway) {
        this.avgScoreAway = avgScoreAway;
    }

    public float getAvgConcededHome() {
        return avgConcededHome;
    }

    public void setAvgConcededHome(float avgConcedeHome) {
        this.avgConcededHome = avgConcedeHome;
    }

    public float getAvgConcededAway() {
        return avgConcededAway;
    }

    public void setAvgConcededAway(float avgConcedeAway) {
        this.avgConcededAway = avgConcedeAway;
    }

    public void setHomeTeam(Team homeTeam) {
        this.homeTeam = homeTeam;
    }

    public void setAwayTeam(Team awayTeam) {
        this.awayTeam = awayTeam;
    }

    public void setMatchId(int matchId) {
        this.matchId = matchId;
    }

    public void setHomeScore(int homeScore) {
        this.homeScore = homeScore;
    }

    public void setAwayScore(int awayScore) {
        this.awayScore = awayScore;
    }

    public void setOdds1(float odds1) {
        this.odds1 = odds1;
    }

    public void setOddsX(float oddsX) {
        this.oddsX = oddsX;
    }

    public void setOdds2(float odds2) {
        this.odds2 = odds2;
    }

    public LocalDateTime getGameDate() {
        return gameDate;
    }

    public void setGameDate(LocalDateTime gameDate) {
        this.gameDate = gameDate;
    }

    public String getSeason() {
        return season;
    }

    public void setSeason(String season) {
        this.season = season;
    }

    public boolean isCountryPrio() {
        return countryPrio;
    }

    public String getHomeTeamName() {
        return homeTeamName;
    }

    public void setHomeTeamName(String homeTeamName) {
        this.homeTeamName = homeTeamName;
    }

    public String getAwayTeamName() {
        return awayTeamName;
    }

    public void setAwayTeamName(String awayTeamName) {
        this.awayTeamName = awayTeamName;
    }

    public void setCountryPrio(boolean countryPrio) {
        this.countryPrio = countryPrio;
    }

    public String getLeagueName() {
        return leagueName;
    }

    public void setLeagueName(String leagueName) {
        this.leagueName = leagueName;
    }

    public String getCountryName() {
        return countryName;
    }

    public void setCountryName(String countryName) {
        this.countryName = countryName;
    }

    public String getHomeWin() {
        return homeWin;
    }

    public void setHomeWin(String homeWin) {
        this.homeWin = homeWin;
    }

    public String getDraw() {
        return draw;
    }

    public void setDraw(String draw) {
        this.draw = draw;
    }

    public String getAwayWin() {
        return awayWin;
    }

    public void setAwayWin(String awayWin) {
        this.awayWin = awayWin;
    }

    public Float getScoringScore() {
        return scoringScore;
    }

    public void setScoringScore(Float scoringScore) {
        this.scoringScore = scoringScore;
    }

    public Float getOwnOdds() {
        return ownOdds;
    }

    public void setOwnOdds(Float ownOddsPerdiction) {
        this.ownOdds = ownOddsPerdiction;
    }

    public Float getGivenOdds() {
        return givenOdds;
    }

    public void setGivenOdds(Float givenOdds) {
        this.givenOdds = givenOdds;
    }

    public Float getPercentageToBet() {
        return percentageToBet;
    }

    public void setPercentageToBet(Float percentageToBet) {
        this.percentageToBet = percentageToBet;
    }

    public boolean isAddToBetSlip() {
        return addToBetSlip;
    }

    public void setAddToBetSlip(boolean addToBetSlip) {
        this.addToBetSlip = addToBetSlip;
    }

    public void setBetAmount(Float value) {
        betAmount = value;
    }

    public Float getBetAmount() {
        return betAmount;
    }

    public void setRoundedDiff(float roundedDiff) {
        this.roundedDiff = roundedDiff;
    }

    public float getRoundedDiff() {
        return roundedDiff;
    }

    public void setDrawPercetage(float drawPercentage) {
        this.drawPercentage = drawPercentage;
    }

    public float getDrawPercent() {
        return this.drawPercentage;
    }

    public String getAnalysisValue() {
        return analysisValue;
    }

    public void setAnalysisValue(int analysisValue) {
        this.analysisValue = analysisValue == 0 ? "No Bet" : String.valueOf(analysisValue);
    }

    public int getAnalysisValueInt() {
        Integer intValue;
        try {
            intValue = Integer.valueOf(getAnalysisValue());
        } catch (NumberFormatException e) {
            intValue = 0;
        }
        return intValue;
    }

    public Bet getPreviousBet() {
        return bet;
    }

    public void setPreviousBet(Bet bet) {
        this.bet = bet;
    }

}
