package tars.model.task;

import tars.commons.util.CollectionUtil;
import tars.model.tag.UniqueTagList;

import java.util.Objects;

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

    private Name name;
    private Phone phone;
    private Email email;
    private Address address;

    private UniqueTagList tags;

    /**
     * Every field must be present and not null.
     */
    public Task(Name name, Phone phone, Email email, Address address, UniqueTagList tags) {
        assert !CollectionUtil.isAnyNull(name, phone, email, address, tags);
        this.name = name;
        this.phone = phone;
        this.email = email;
        this.address = address;
        this.tags = new UniqueTagList(tags); // protect internal tags from changes in the arg list
    }

    /**
     * Copy constructor.
     */
    public Task(ReadOnlyTask source) {
        this(source.getName(), source.getPhone(), source.getEmail(), source.getAddress(), source.getTags());
    }

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

    @Override
    public Phone getPhone() {
        return phone;
    }

    @Override
    public Email getEmail() {
        return email;
    }

    @Override
    public Address getAddress() {
        return address;
    }

    @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);
    }

    @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, phone, email, address, tags);
    }

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

}

@@ -158,16 +158,17 @@
 in tars.
+ 
 %0A * Guar
@@ -305,24 +305,114 @@
  Name name;%0A
+    private DateTime dateTime;%0A    private Status status;%0A    private Priority priority;%0A%0A
     private 
@@ -934,16 +934,518 @@
 ags from
+%0A                                             // changes in the arg list%0A    %7D%0A%0A    public Task(Name name, DateTime dateTime, Priority priority, Status status, UniqueTagList tags) %7B%0A        assert !CollectionUtil.isAnyNull(name, dateTime, priority, tags);%0A        this.name = name;%0A        this.dateTime = dateTime;%0A        this.priority = priority;%0A        this.status = status;%0A        this.tags = new UniqueTagList(tags); // protect internal tags from%0A                                             //
  changes
@@ -1589,20 +1589,23 @@
 urce.get
-Phon
+DateTim
 e(), sou
@@ -1611,21 +1611,24 @@
 urce.get
-Email
+Priority
 (), sour
@@ -1633,22 +1633,21 @@
 urce.get
-Addres
+Statu
 s(), sou
@@ -1731,32 +1731,370 @@
 rn name;%0A    %7D%0A%0A
+    @Override%0A    public DateTime getDateTime() %7B%0A        return dateTime;%0A    %7D%0A%0A    @Override%0A    public Status getStatus() %7B%0A        return status;%0A    %7D%0A%0A    @Override%0A    public Priority getPriority() %7B%0A        return priority;%0A    %7D%0A%0A    @Override%0A    public UniqueTagList getTags() %7B%0A        return new UniqueTagList(tags);%0A    %7D%0A%0A
     @Override%0A  
@@ -2306,106 +2306,8 @@
  %7D%0A%0A
-    @Override%0A    public UniqueTagList getTags() %7B%0A        return new UniqueTagList(tags);%0A    %7D%0A%0A
     
@@ -2697,16 +2697,24 @@
         
+        
 && this.
@@ -2876,16 +2876,27 @@
 ementing
+%0A        //
  your ow

Modify Task