package guitests.guihandles;

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

/**
 * Provides a handle to a person card in the person list panel.
 */
public class PersonCardHandle extends GuiHandle {
    private static final String NAME_FIELD_ID = "#name";
    private static final String ADDRESS_FIELD_ID = "#priority";
    private static final String PHONE_FIELD_ID = "#startTime";
    private static final String EMAIL_FIELD_ID = "#endTime";

    private Node node;

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

    protected String getTextFromLabel(String fieldId) {
        return getTextFromLabel(fieldId, node);
    }

    public String getFullName() {
        return getTextFromLabel(NAME_FIELD_ID);
    }

    public String getAddress() {
        return getTextFromLabel(ADDRESS_FIELD_ID);
    }

    public String getPhone() {
        return getTextFromLabel(PHONE_FIELD_ID);
    }

    public String getEmail() {
        return getTextFromLabel(EMAIL_FIELD_ID);
    }

    public boolean isSamePerson(ReadOnlyTask person){
        return getFullName().equals(person.getTaskDetails().taskDetails) && getPhone().equals("Starts:   "+person.getStartTime().toCardString())
                && getEmail().equals("Ends:     "+person.getEndTime().toCardString()) && getAddress().equals("Priority: "+person.getPriority().priorityLevel);
    }

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

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

@@ -1279,26 +1279,25 @@
 ails().t
-askDetails
+oString()
 ) && get
@@ -1509,21 +1509,18 @@
 y().
-priorityLevel
+toString()
 );%0A 
@@ -1931,32 +1931,32 @@
 oString() %7B%0A
-
         
 return getFu
@@ -1935,32 +1935,453 @@
 ing() %7B%0A        
+final StringBuilder builder = new StringBuilder();%0A        builder.append(getFullName()+ %22%5Cn%22)%0A                .append(%22Start time: %22)%0A                .append(getPhone() + %22%5Ct%22)%0A                .append(%22End time:%22)%0A                .append(getEmail() + %22%5Cn%22)%0A                .append(%22Priority: %22)%0A                .append(getAddress()+ %22%5Cn%22)%0A                .append(%22Tags: %22);%0A        return builder.toString();%0A%0A        //
 return getFullNa

Update toString() for PersonCardHandle