package seedu.tasklist.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.tasklist.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

    private static final String FXML = "TaskListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;

    @FXML
    private Label comment;
    
    @FXML
    private Label priority;
    @FXML
    private Label startDate;
    @FXML
    private Label endDate;

    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask task, int displayedIndex) {
        super(FXML);
        name.setText(task.getName().fullName);
        id.setText(displayedIndex + ". ");
        comment.setText(task.getComment().value);
        initTags(task);
    }

    private void initTags(ReadOnlyTask task) {
        task.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

@@ -186,16 +186,118 @@
 Region;%0A
+import seedu.tasklist.model.task.DeadlineTask;%0Aimport seedu.tasklist.model.task.ReadOnlyDeadlineTask;%0A
 import s
@@ -335,16 +335,16 @@
 lyTask;%0A
-
 %0Apublic 
@@ -590,13 +590,9 @@
 nt;%0A
-    
 %0A
+
     
@@ -797,24 +797,24 @@
 yedIndex) %7B%0A
-
         supe
@@ -822,16 +822,201 @@
 (FXML);%0A
+        String taskType = task.getType();%0A        switch(taskType) %7B%0A        case DeadlineTask.TYPE:%0A            endDate.setText(((ReadOnlyDeadlineTask) task).getDeadline());%0A        %7D%0A
         

add DeadlineTask to TaskCard