import components.betsequences.BetSequencesTable;
import components.matchtable.MatchTable;
import components.newBetForm.NewBetForm;
import data.GuiMysql;
import objects.SoccerMatch;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import java.time.LocalDateTime;
import java.util.List;

public class MainPage extends WebPage {
    public MainPage(final PageParameters parameters) {
        super(parameters);

        List<SoccerMatch> todaysMatches = GuiMysql.getInstance()
                .getPrioMatchesOfDate(LocalDateTime.now().toLocalDate().toString());

        List<SoccerMatch> tomorrowsMatches = GuiMysql.getInstance()
                .getPrioMatchesOfDate(LocalDateTime.now().toLocalDate().plusDays(1).toString());

        // List of todays matches with calculated percentages

        Label todaysLabel = new Label("todaysLabel", "Todays matches");
        add(todaysLabel);
        add(new MatchTable("todaysMatches", todaysMatches));

        // List of tomorrows matches with calculated percentages
        add(new Label("tomorrowsLabel", "Tomorrows matches"));
        add(new MatchTable("tomorrowsMatches", tomorrowsMatches));

        // Current bet sequences
        add(new Label("currentBetSequencesLabel"));
        add(new BetSequencesTable("currentBetSequences"));

        // A way to add bets
        add(new Label("newBetLabel", "New bet"));
        add(new NewBetForm("newBetForm"));
    }


}