package seedu.ezdo.model.todo;

import java.util.Objects;

import seedu.ezdo.commons.util.CollectionUtil;
import seedu.ezdo.model.tag.UniqueTagList;

/**
 * Represents a Task in ezDo.
 * Guarantees: details are present and not null, field values are validated.
 */
public class Task implements ReadOnlyTask {

    private Name name;
    private Priority priority;
    private TaskDate startDate;
    private TaskDate dueDate;
    private boolean done;

    private UniqueTagList tags;

    /**
     * Every field must be present and not null.
     */
    public Task(Name name, Priority priority, TaskDate startDate, TaskDate dueDate, UniqueTagList tags) {
        assert !CollectionUtil.isAnyNull(name, priority, startDate, tags);
        this.name = name;
        this.priority = priority;
        this.startDate = startDate;
        this.dueDate = dueDate;
        this.tags = new UniqueTagList(tags); // protect internal tags from changes in the arg list
        this.done = false;
    }

    /**
     * Creates a copy of the given ReadOnlyTask.
     */
    public Task(ReadOnlyTask source) {
        this(source.getName(), source.getPriority(),
                source.getStartDate(), source.getDueDate(), source.getTags());
    }

    public void setName(Name name) {
        assert name != null;
        this.name = name;
    }

    public void setDone(boolean doneStatus) {
        this.done = doneStatus;
    }

    public void setDone() {
        this.done = true;
    }

    @Override
    public Name getName() {
        return name;
    }

    public void setPriority(Priority priority) {
        assert priority != null;
        this.priority = priority;
    }

    @Override
    public Priority getPriority() {
        return priority;
    }

    public void setStartDate(TaskDate startDate) {
        assert startDate != null;
        this.startDate = startDate;
    }

    @Override
    public boolean getDone() {
        return this.done;
    }

    @Override
    public TaskDate getStartDate() {
        return startDate;
    }

    public void setDueDate(TaskDate dueDate) {
        assert dueDate != null;
        this.dueDate = dueDate;
    }

    @Override
    public TaskDate getDueDate() {
        return dueDate;
    }

    @Override
    public UniqueTagList getTags() {
        return new UniqueTagList(tags);
    }

    /**
     * Replaces this task's tags with the tags in the argument tag list.
     */
    public void setTags(UniqueTagList replacement) {
        tags.setTags(replacement);
    }

    /**
     * Updates this task with the details of {@code replacement}.
     */
    public void resetData(ReadOnlyTask replacement) {
        assert replacement != null;

        this.setName(replacement.getName());
        this.setPriority(replacement.getPriority());
        this.setStartDate(replacement.getStartDate());
        this.setDueDate(replacement.getDueDate());
        this.setTags(replacement.getTags());
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof ReadOnlyTask // instanceof handles nulls
                && this.isSameStateAs((ReadOnlyTask) other));
    }

    @Override
    public int hashCode() {
        // use this method for custom fields hashing instead of implementing your own
        return Objects.hash(name, priority, startDate, tags);
    }

    @Override
    public String toString() {
        return getAsText();
    }

}

@@ -176,19 +176,16 @@
 in ezDo.
-%0A *
  Guarant
@@ -222,16 +222,19 @@
 ot null,
+%0A *
  field v
@@ -444,16 +444,41 @@
 an done;
+%0A    private Recur recur;
 %0A%0A    pr
@@ -652,16 +652,29 @@
 dueDate,
+ Recur recur,
  UniqueT
@@ -887,24 +887,52 @@
  = dueDate;%0A
+        this.recur = recur;%0A
         this
@@ -993,16 +993,64 @@
 ags from
+%0A                                             //
  changes
@@ -1256,32 +1256,16 @@
 ority(),
-%0A               
  source.
@@ -1296,24 +1296,59 @@
 etDueDate(),
+ source.getRecur(),%0A               
  source.getT
@@ -2164,32 +2164,215 @@
 artDate;%0A    %7D%0A%0A
+    public void setRecur(Recur recur) %7B%0A        assert recur != null;%0A        this.recur = recur;%0A    %7D%0A%0A    @Override%0A    public Recur getRecur() %7B%0A        return this.recur;%0A    %7D%0A%0A
     public void 
@@ -3204,32 +3204,79 @@
 .getDueDate());%0A
+        this.setRecur(replacement.getRecur());%0A
         this.set
@@ -3522,16 +3522,24 @@
         
+        
 && this.
@@ -3701,16 +3701,27 @@
 ementing
+%0A        //
  your ow

Update Task to recognise recur input