//@@author A0139930B
package seedu.taskitty.testutil;

import seedu.taskitty.model.tag.UniqueTagList;
import seedu.taskitty.model.task.*;

/**
 * A mutable person object. For testing only.
 */
public class TestTask implements ReadOnlyTask, Comparable<TestTask> {

    private Name name;
    private TaskPeriod period;
    private boolean isDone;
    private boolean isOverdue;
    private boolean isOver;
    private UniqueTagList tags;

    public TestTask() {
        tags = new UniqueTagList();
    }

    public void setName(Name name) {
        this.name = name;
    }
    
    public void setPeriod(TaskPeriod period) {
        this.period = period;
    }

    @Override
    public Name getName() {
        return name;
    }
    
    @Override
    public TaskPeriod getPeriod() {
        return period;
    }
    
    @Override
    public boolean getIsDone() {
        return isDone;
    }

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

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

    public String getAddCommand() {
        StringBuilder sb = new StringBuilder();
        sb.append("add " + this.getName().fullName + " ");
        if (period.getStartDate() != null && period.getStartTime() != null) {
            sb.append(period.getStartDate().toString() + " " + period.getStartTime().toString() + " to ");
        }
        if (period.getEndDate() != null && period.getEndTime() != null) {
            sb.append(period.getEndDate().toString() + " " + period.getEndTime().toString() + " ");
        }
        this.getTags().getInternalList().stream().forEach(s -> sb.append("t/" + s.tagName + " "));
        return sb.toString();
    }
    
    //@@author
    public String getEditCommand(int index, char category) {
        StringBuilder sb = new StringBuilder();
        sb.append("edit " + category + index + " " + this.getName().fullName + " ");
        if (period.getStartDate() != null && period.getStartTime() != null) {
            sb.append(period.getStartDate().toString() + " " + period.getStartTime().toString() + " to ");
        }
        if (period.getEndDate() != null && period.getEndTime() != null) {
            sb.append(period.getEndDate().toString() + " " + period.getEndTime().toString() + " ");
        }
        this.getTags().getInternalList().stream().forEach(s -> sb.append("t/" + s.tagName + " "));
        return sb.toString();
    }

    @Override
	public boolean isTodo() {
		return period.isTodo();
	}
	
	@Override
	public boolean isDeadline() {
		return period.isDeadline();
	}
	
	@Override
	public boolean isEvent() {
		return period.isEvent();
	}
	
	//@@author A0130853L
	public void markAsDone() {
		isDone = true;
	}
	
	@Override
	public boolean isOverdue() {
		return isOverdue;
	}
	
	//@@author A0139052L
	@Override
    public int compareTo(TestTask taskToCompare) {
	    // sort all tasks that are done to the back of the list
        if (this.getIsDone() && !taskToCompare.getIsDone()) {
            return 1;
        } else if (!this.getIsDone() && taskToCompare.getIsDone()) {
            return -1;
        } else if (!this.getIsDone() &&!taskToCompare.getIsDone()) {
        	 int periodCompare = this.period.compareTo(taskToCompare.getPeriod());
             //If no difference is found in period, compare using name
             if (periodCompare == 0) {
                 return this.getName().fullName.compareTo(taskToCompare.getName().fullName);
             } else {
                 return periodCompare;
             }
        
        } else {
        	int periodCompare = taskToCompare.getPeriod().compareTo(this.period);
            //If no difference is found in period, compare using name
            if (periodCompare == 0) {
                return this.getName().fullName.compareTo(taskToCompare.getName().fullName);
            } else {
                return periodCompare;
            }
        }
        
	}
}

@@ -1,25 +1,4 @@
-//@@author A0139930B%0A
 pack
@@ -27,16 +27,53 @@
 tutil;%0A%0A
+import seedu.taskitty.model.tag.Tag;%0A
 import s
@@ -148,16 +148,37 @@
 ask.*;%0A%0A
+//@@author A0139930B%0A
 /**%0A * A
@@ -1674,36 +1674,46 @@
 (s -%3E sb.append(
-%22t/%22
+Tag.TAG_PREFIX
  + s.tagName + %22
@@ -2424,12 +2424,22 @@
 end(
-%22t/%22
+Tag.TAG_PREFIX
  + s

Change test to use #