package seedu.address.model.item;

import seedu.address.model.tag.UniqueTagList;

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

    ItemType getItemType();
    Name getName();
    Date getStartDate();
    Time getStartTime();
    Date getEndDate();
    Time getEndTime();

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

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

    /**
     * Formats the person as text, showing all contact details.
     */
    default String getAsText() {
        final StringBuilder builder = new StringBuilder();
        builder.append(getItemType())
                .append(" Name: ")
                .append(getName())
                .append(" Email: ")
                .append(getEndDate())
                .append(" Address: ")
                .append(getEndTime())
                .append(" Tags: ");
        getTags().forEach(builder::append);
        return builder.toString();
    }

    /**
     * Returns a string representation of this Item'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());
        }
    }

}

@@ -1470,32 +1470,33 @@
 ppend(getName())
+;
 %0A               
@@ -1492,36 +1492,425 @@
     
-        .append(%22 Email
+if (getItemType().toString().equals(ItemType.EVENT_WORD)) %7B%0A            builder.append(%22 Start Date: %22)%0A                   .append(getStartDate())%0A                   .append(%22 Start time: %22)%0A                   .append(getStartTime());%0A        %7D%0A        if (getItemType().toString().equals(ItemType.DEADLINE_WORD) %7C%7C getItemType().toString().equals(ItemType.EVENT_WORD)) %7B%0A            builder.append(%22 End Date
 : %22)%0A
+   
     
@@ -1951,32 +1951,35 @@
                 
+ 
+  
 .append(%22 Addres
@@ -1976,15 +1976,16 @@
 d(%22 
-Address
+End time
 : %22)
@@ -1993,32 +1993,35 @@
                 
+   
 .append(getEndTi
@@ -2021,24 +2021,25 @@
 etEndTime())
+;
 %0A           
@@ -2031,32 +2031,34 @@
 ));%0A        
+%7D%0A
         
 .append(%22 Ta
@@ -2037,32 +2037,39 @@
       %7D%0A        
+builder
 .append(%22 Tags: 

Update ReadOnlyItem to return correct string representation and handle tasks, deadlines, events correctly