package tars.model.task;

import tars.model.tag.UniqueTagList;

/**
 * A read-only immutable interface for a Task in the addressbook.
 * Implementations should guarantee: details are present and not null, field values are validated.
 */
public interface ReadOnlyTask {

    Name getName();
    Phone getPhone();
    Email getEmail();
    Address getAddress();
    DateTime getDateTime();
    Status getStatus();
    Priority getPriority();
    

    /**
     * The returned TagList is a deep copy of the internal TagList,
     * changes on the returned list will not affect the task's internal tags.
     */
    UniqueTagList getTags();

    /**
     * Returns true if both have the same state. (interfaces cannot override .equals)
     */
    default boolean isSameStateAs(ReadOnlyTask other) {
        return other == this // short circuit if same object
                || (other != null // this is first to avoid NPE below
                && other.getName().equals(this.getName())); // state checks here onwards
//                && other.getPhone().equals(this.getPhone())
//                && other.getEmail().equals(this.getEmail())
//                && other.getAddress().equals(this.getAddress()));
    }

    /**
     * Formats the task as text, showing all contact details.
     */
    default String getAsText() {
        final StringBuilder builder = new StringBuilder();
        builder.append(getName())
                .append(" DateTime: ")
                .append(getDateTime())
                .append(" Priority: ")
                .append(getPriority())
                .append(" Tags: ");
        getTags().forEach(builder::append);
        return builder.toString();
    }

    /**
     * Returns a string representation of this Task's tags
     */
    default String tagsString() {
        final StringBuffer buffer = new StringBuffer();
        final String separator = ", ";
        getTags().forEach(tag -> buffer.append(tag).append(separator));
        if (buffer.length() == 0) {
            return "";
        } else {
            return buffer.substring(0, buffer.length() - separator.length());
        }
    }

}

@@ -261,16 +261,336 @@
 lyTask %7B
+%0A    %0A    public static final String PRIORITY_HIGH = %22high%22;%0A    public static final String PRIORITY_MEDIUM = %22medium%22;%0A    public static final String PRIORITY_LOW = %22low%22;%0A%0A    public static final String PRIORITY_H = %22h%22;%0A    public static final String PRIORITY_M = %22m%22;%0A    public static final String PRIORITY_L = %22l%22;
 %0A%0A    Na
@@ -1873,27 +1873,30 @@
 .append(
-getP
+p
 riority
+String
 ())%0A    
@@ -1971,16 +1971,16 @@
 ppend);%0A
-
         
@@ -2003,32 +2003,501 @@
 oString();%0A    %7D
+%0A    %0A    /**%0A     * Returns a string representation of this Task's priority%0A     */%0A    default String priorityString() %7B%0A        String level = %22%22;%0A        switch (getPriority().toString()) %7B%0A        case PRIORITY_H:%0A            level = PRIORITY_HIGH;%0A            break;%0A        case PRIORITY_M:%0A            level = PRIORITY_MEDIUM;%0A            break;%0A        case PRIORITY_L:%0A            level = PRIORITY_LOW;%0A            break;%0A        %7D%0A        return level;%0A    %7D
 %0A%0A    /**%0A     *

Move format priority to ReadOnlyTask.java Follows tagsString()