package guitests.guihandles;

import guitests.GuiRobot;
import javafx.scene.Node;
import javafx.stage.Stage;
import seedu.taskitty.model.task.ReadOnlyTask;

/**
 * Provides a handle to a task card in the task list panel.
 */
public class TaskCardHandle extends GuiHandle {
    private static final String NAME_FIELD_ID = "#name";

    private Node node;

    public TaskCardHandle(GuiRobot guiRobot, Stage primaryStage, Node node){
        super(guiRobot, primaryStage, null);
        this.node = node;
    }

    protected String getTextFromLabel(String fieldId) {
        return getTextFromLabel(fieldId, node);
    }
    //@@author A0130853L
    // get the CSS in line style of the specified label, returned as a string
    protected String getStyleFromLabel(String fieldId) {
    	return getStyleFromLabel(fieldId, node);
    }
    
    // get the CSS in line style of the name of the task card as a helper method for checking if its marked as done.
    public String getStyle() {
    	return getStyleFromLabel(NAME_FIELD_ID);
    }
    //@@author
    public String getFullName() {
        return getTextFromLabel(NAME_FIELD_ID);
    }

    public boolean isSameTask(ReadOnlyTask task){
        return getFullName().equals(task.getName().fullName);
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof TaskCardHandle) {
            TaskCardHandle handle = (TaskCardHandle) obj;
            return getFullName().equals(handle.getFullName()); //TODO: compare the rest
        }
        return super.equals(obj);
    }

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

@@ -102,16 +102,65 @@
 .Stage;%0A
+import seedu.taskitty.commons.util.DateTimeUtil;%0A
 import s
@@ -371,16 +371,336 @@
 %22#name%22;
+%0A    private static final String START_DATE_FIELD_ID = %22#startDate%22;%0A    private static final String START_TIME_FIELD_ID = %22#startTime%22;%0A    private static final String END_DATE_FIELD_ID = %22#endDate%22;%0A    private static final String END_TIME_FIELD_ID = %22#endTime%22;%0A    private static final String TAG_FIELD_ID = %22#tags%22;
 %0A%0A    pr
@@ -1499,24 +1499,509 @@
 ID);%0A    %7D%0A%0A
+    public String getStartDate() %7B%0A        return getTextFromLabel(START_DATE_FIELD_ID);%0A    %7D%0A    %0A    public String getStartTime() %7B%0A        return getTextFromLabel(START_TIME_FIELD_ID);%0A    %7D%0A     %0A    public String getEndDate() %7B%0A        return getTextFromLabel(END_DATE_FIELD_ID);%0A    %7D%0A    %0A    public String getEndTime() %7B%0A        return getTextFromLabel(END_TIME_FIELD_ID);%0A    %7D    %0A    %0A    public String getTags() %7B%0A        return getTextFromLabel(TAG_FIELD_ID);%0A    %7D%0A    %0A
     public b
@@ -2038,16 +2038,49 @@
  task)%7B%0A
+        if (task.isTodo()) %7B%0A    
         
@@ -2135,236 +2135,1565 @@
 ame)
-;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if(obj instanceof TaskCardHandle) %7B%0A            TaskCardHandle handle = (TaskCardHandle) obj;%0A            return getFullName().equals(handle.getFullName()); 
+%0A                    && getTags().equals(task.tagsString());%0A        %7D else if (task.isDeadline()) %7B%0A            return getFullName().equals(task.getName().fullName)%0A                    && getTags().equals(task.tagsString())%0A                    && getEndTime().equals(DateTimeUtil.formatTimeForUI(task.getPeriod().getEndTime()))%0A                    && getEndDate().equals(DateTimeUtil.formatDateForUI(task.getPeriod().getEndDate()));%0A        %7D else %7B%0A            return getFullName().equals(task.getName().fullName)%0A                    && getTags().equals(task.tagsString())%0A                    && getStartTime().equals(DateTimeUtil.formatTimeForUI(task.getPeriod().getStartTime()))%0A                    && getStartDate().equals(DateTimeUtil.formatDateForUI(task.getPeriod().getStartDate()))%0A                    && getEndTime().equals(DateTimeUtil.formatTimeForUI(task.getPeriod().getEndTime()))%0A                    && getEndDate().equals(DateTimeUtil.formatDateForUI(task.getPeriod().getEndDate()));%0A        %7D%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if(obj instanceof TaskCardHandle) %7B%0A            TaskCardHandle handle = (TaskCardHandle) obj;%0A            return getFullName().equals(handle.getFullName())%0A                    && getTags().equals(handle.getTags())%0A                    && getStartDate().equals(handle.getStartDate())%0A                    && getStartTime().equals(handle.getStartTime())%0A                    && getEndDate().equals(handle.getEndDate())%0A                    && getEndTime().equals(handle.getEndTime());
 //TO

Update TaskCardHandle to check for the Date, Time and Tags in the task for the same Task