package seedu.taskell.model.task;

import seedu.taskell.model.tag.UniqueTagList;

/**
 * A read-only immutable interface for a Task in the taskmanager.
 * Implementations should guarantee: details are present and not null, field values are validated.
 */
public interface ReadOnlyTask {
    Description getDescription();
    TaskDate getTaskDate();
    TaskTime getTaskTime();
    TaskPriority getTaskPriority();

    /**
     * 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.getDescription().equals(this.getDescription()) // state checks here onwards
                && other.getTaskDate().equals(this.getTaskDate())
                && other.getTaskTime().equals(this.getTaskTime())
                && other.getTaskPriority().equals(this.getTaskPriority()));
    }

    /**
     * Formats the task as text, showing all contact details.
     */
    default String getAsText() {
        final StringBuilder builder = new StringBuilder();
        builder.append(getDescription())
                .append(" TaskDate: ")
                .append(getTaskDate())
                .append(" TaskTime: ")
                .append(getTaskTime())
                .append(" TaskPriority: ")
                .append(getTaskPriority())
                .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());
        }
    }

}

@@ -2224,12 +2224,548 @@
  %7D%0A    %7D
+%0A    %0A    /**%0A     * @return a simple string representation of this Task's tags%0A     *          with each tag separated by a whitespace%0A     */%0A    default String tagsSimpleString() %7B%0A        final StringBuffer buffer = new StringBuffer();%0A        final String separator = %22 %22;%0A        getTags().forEach(tag -%3E buffer.append(tag.toSimpleString()).append(separator));%0A        if (buffer.length() == 0) %7B%0A            return %22%22;%0A        %7D else %7B%0A            return buffer.substring(0, buffer.length() - separator.length());%0A        %7D%0A    %7D
 %0A%0A%7D%0A

add method to return tags in unformatted string