package seedu.ezdo.commons.util;

import java.util.Optional;
import java.util.Set;

import seedu.ezdo.model.todo.DueDate;
import seedu.ezdo.model.todo.Priority;
import seedu.ezdo.model.todo.StartDate;

public class SearchParameters {
	private Set<String> namesToCompare;
	private Optional<Priority> priorityToCompare;
	private Optional<StartDate> startDateToCompare;
	private Optional<DueDate> dueDateToCompare;
	private Set<String> tagsToCompare;
	private boolean startBefore = false;
	private boolean dueBefore = false;
	private boolean startAfter = false;
	private boolean dueAfter = false;
	
	public Set<String> getNames() {
		return namesToCompare;
	}

	public Optional<Priority> getPriority() {
		return priorityToCompare;
	}

	public Optional<StartDate> getStartDate() {
		return startDateToCompare;
	}

	public Optional<DueDate> getDueDate() {
		return dueDateToCompare;
	}

	public Set<String> getTags() {
		return tagsToCompare;
	}

	public boolean getStartBefore() {
		return startBefore;
	}

	public boolean getdueBefore() {
		return dueBefore;
	}

	public boolean getStartAfter() {
		return startAfter;
	}

	public boolean getDueAfter() {
		return dueAfter;
	}

	public static class Builder {
		// required parameters
		private Set<String> namesToCompare;
		private Optional<Priority> priorityToCompare;
		private Optional<StartDate> startDateToCompare;
		private Optional<DueDate> dueDateToCompare;
		private Set<String> tagsToCompare;
		private boolean startBefore = false;
		private boolean dueBefore = false;
		private boolean startAfter = false;
		private boolean dueAfter = false;

		public Builder(Set<String> names, Optional<Priority> priority, Optional<StartDate> startDate,
	    		 Optional<DueDate> dueDate, Set<String> tags) {  
	       this.namesToCompare = names;  
	       this.priorityToCompare = priority;
	       this.startDateToCompare = startDate;
	       this.dueDateToCompare = dueDate;
	       this.tagsToCompare = tags;
		}

		public Builder startBefore(boolean before) {
			startBefore = before;
			return this;
		}

		public Builder dueBefore(boolean before) {
			dueBefore = before;
			return this;
		}

		public Builder startAfter(boolean after) {
			startAfter = after;
			return this;
		}

		public Builder dueAfter(boolean after) {
			dueAfter = after;
			return this;
		}

		public SearchParameters build() {
			return new SearchParameters(this);
		}
	}

	private SearchParameters(Builder builder) {
		namesToCompare = builder.namesToCompare;
		priorityToCompare = builder.priorityToCompare;
		startDateToCompare = builder.startDateToCompare;
		dueDateToCompare = builder.dueDateToCompare;
		tagsToCompare = builder.tagsToCompare;
		startBefore = builder.startBefore;
		dueBefore = builder.dueBefore;
		startAfter = builder.startAfter;
		dueAfter = builder.dueAfter;
	}
}

@@ -81,46 +81,8 @@
 t;%0A%0A
-import seedu.ezdo.model.todo.DueDate;%0A
 impo
@@ -145,21 +145,20 @@
 el.todo.
-Start
+Task
 Date;%0A%0Ap
@@ -282,37 +282,36 @@
 rivate Optional%3C
-Start
+Task
 Date%3E startDateT
@@ -330,35 +330,36 @@
 rivate Optional%3C
-Due
+Task
 Date%3E dueDateToC
@@ -700,29 +700,28 @@
 ic Optional%3C
-Start
+Task
 Date%3E getSta
@@ -777,27 +777,28 @@
 ic Optional%3C
-Due
+Task
 Date%3E getDue
@@ -1282,37 +1282,36 @@
 rivate Optional%3C
-Start
+Task
 Date%3E startDateT
@@ -1331,35 +1331,36 @@
 rivate Optional%3C
-Due
+Task
 Date%3E dueDateToC
@@ -1576,239 +1576,288 @@
 der(
-Set%3CString%3E names, Optional%3CPriority%3E priority, Optional%3CStartDate%3E startDate,%0A%09    %09%09 Optional%3CDueDate%3E dueDate, Set%3CString%3E tags) %7B  %0A%09       this.namesToCompare = names;  %0A%09       this.priorityToCompare = priority;%0A%09       this.
+) %7B  %0A%0A%09%09%7D%0A%0A%09%09public Builder name(Set%3CString%3E names) %7B%0A%09%09%09namesToCompare = names;%0A%09%09%09return this;%0A%09%09%7D%0A%0A%09%09public Builder priority(Optional%3CPriority%3E priority) %7B%0A%09%09%09priorityToCompare = priority;%0A%09%09%09return this;%0A%09%09%7D%0A%0A%09%09public Builder startDate(Optional%3CTaskDate%3E findStartDate) %7B%0A%09%09%09
 star
@@ -1873,17 +1873,21 @@
 mpare = 
-s
+findS
 tartDate
@@ -1893,61 +1893,180 @@
 e;%0A%09
-       this.dueDateToCompare = dueDate;%0A%09       this.
+%09%09return this;%0A%09%09%7D%0A%0A%09%09public Builder dueDate(Optional%3CTaskDate%3E dueDate) %7B%0A%09%09%09dueDateToCompare = dueDate;%0A%09%09%09return this;%0A%09%09%7D%0A%0A%09%09public Builder tags(Set%3CString%3E tags) %7B%0A%09%09%09
 tags
@@ -2083,16 +2083,32 @@
 = tags;%0A
+%09%09%09return this;%0A
 %09%09%7D%0A%0A%09%09p

Change variables to their superclass