package seedu.tasklist.model.task;

import java.util.Date;
import java.util.Objects;

import seedu.tasklist.commons.util.CollectionUtil;
import seedu.tasklist.model.tag.UniqueTagList;

/**
* Represents a Task with start and end date in the task list.
* Guarantees: details are present and not null, field values are validated.
*/
public class EventTask extends Task implements ReadOnlyEventTask {

    private Name name;
    private Comment comment;
    private Priority priority;
    private Status status;
    private Date startDate;
    private Date endDate;

    private UniqueTagList tags;

    public static final String TYPE = "event";


    public EventTask(Name name, Comment comment, Priority priority, Status status,
                     Date startDate, Date endDate, UniqueTagList tags) {
        assert !CollectionUtil.isAnyNull(name, startDate, endDate, status);
        this.name = name;
        this.comment = comment;
        this.priority = priority;
        this.status = status;
        this.startDate = startDate;
        this.endDate = endDate;
        this.tags = new UniqueTagList(tags); // protect internal tags from changes in the arg list

    }

    /**
     * Creates a copy of the given ReadOnlyEventTask.
     */
    public EventTask(ReadOnlyEventTask source) {
        this(source.getName(), source.getComment(), source.getPriority(),
             source.getStatus(), source.getStartDate(), source.getEndDate(), source.getTags());
    }

    public void setStartDate(Date startDate) {
        assert startDate != null;
        this.startDate = startDate;
    }

    public void setEndDate(Date endDate) {
        assert endDate != null;
        this.endDate = endDate;
    }

    public void setPriority(Priority priority) {
        assert priority != null;
        this.priority = priority;
    }

    @Override
    public Priority getPriority() {
        return priority;
    }

    public void setStatus(Status status) {
        assert status != null;
        this.status = status;
    }

    @Override
    public Status getStatus() {
        return status;
    }

    public void setName(Name name) {
        assert name != null;
        this.name = name;
    }

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

    public void setComment(Comment comment) {
        assert comment != null;
        this.comment = comment;
    }

    @Override
    public Comment getComment() {
        return comment;
    }

    @Override
    public Date getStartDate() {
        return startDate;
    }

    @Override
    public Date getEndDate() {
        return endDate;
    }

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

    /**
     * Replaces this person's tags with the tags in the argument tag list.
     */
    public void setTags(UniqueTagList replacement) {
        tags.setTags(replacement);
    }

    /**
     * Updates this person with the details of {@code replacement}.
     */
    public void resetData(ReadOnlyEventTask replacement) {
        assert replacement != null;

        this.setName(replacement.getName());
        this.setComment(replacement.getComment());
        this.setPriority(replacement.getPriority());
        this.setStatus(replacement.getStatus());
        this.setStartDate(replacement.getStartDate());
        this.setEndDate(replacement.getEndDate());
        this.setTags(replacement.getTags());
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof ReadOnlyEventTask // instanceof handles nulls
                && this.isSameStateAs((ReadOnlyEventTask) other));
    }

    @Override
    public int hashCode() {
        // use this method for custom fields hashing instead of implementing your own
        return Objects.hash(name, startDate, endDate, tags);
    }

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

    @Override
    public String getType() {
        return TYPE;
    }

}

@@ -29,16 +29,80 @@
 .task;%0A%0A
+import java.text.DateFormat;%0Aimport java.text.SimpleDateFormat;%0A
 import j
@@ -2631,50 +2631,414 @@
 lic 
-Date getEndDate() %7B%0A        return endDate
+String getStartDateString() %7B%0A        DateFormat dateFormat = new SimpleDateFormat(%22dd/MM/yyyy HH:mm:ss%22);%0A        return dateFormat.format(startDate);%0A    %7D%0A%0A    @Override%0A    public Date getEndDate() %7B%0A        return endDate;%0A    %7D%0A%0A    @Override%0A    public String getEndDateString() %7B%0A        DateFormat dateFormat = new SimpleDateFormat(%22dd/MM/yyyy HH:mm:ss%22);%0A        return dateFormat.format(endDate)
 ;%0A  

add getStartDateString and getEndDateString to EventTask