package design.model; import com.fasterxml.jackson.annotation.JsonCreator; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; import java.util.List; public class Match { private final Course course; private final Date dateScheduled; private final LocalDateTime start; private final int holeCount; private final List rounds; @JsonCreator private Match(Course course, Date dateScheduled, LocalDateTime start, int holeCount, List rounds) { this.course = course; this.dateScheduled = dateScheduled; this.start = start; this.holeCount = holeCount; this.rounds = rounds; } public Match(Course course, Date dateScheduled, LocalDateTime start, int holeCount) { this.course = course; this.dateScheduled = dateScheduled; this.start = start; this.holeCount = holeCount; this.rounds = new ArrayList<>(); } public Course getCourse() { return course; } public Date getDateScheduled() { return dateScheduled; } public LocalDateTime getStart() { return start; } public int getHoleCount() { return holeCount; } public boolean addRound(Round round) { return rounds.add(round); } public Round[] getRounds() { return rounds.toArray(Round[]::new); } }