//@@author A0147996E
package seedu.address.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.address.model.task.Event;
import seedu.address.model.task.ReadOnlyRecurringTask;
import seedu.address.model.task.ReadOnlyRecurringTask.RecurringMode;
import seedu.address.model.task.ReadOnlyTask;
import seedu.address.model.task.ReadOnlyTask.RecurringProperty;
import seedu.address.model.task.RecurringTask;

/**
 * Taskcard defines format for individual task view.
 */
public class TaskListCard extends UiPart<Region> {

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

    @FXML
    private HBox taskCardPane;
    @FXML
    private Label tag;
    @FXML
    private Label index;
    @FXML
    private Label name;
    @FXML
    private Label date;
    @FXML
    private Label time;
    @FXML
    private Label startDate;
    @FXML
    private Label startTime;
    @FXML
    private Label pastDue;
    @FXML
    private Label description;
    @FXML
    private Label venue;
    @FXML
    private Label priority;
    @FXML
    private Label isFavorite;
    @FXML
    private Label isFinished;
    @FXML
    private Label isRecurring;

    public TaskListCard(ReadOnlyTask task, int displayedIndex) {
        super(FXML);
        index.setText(displayedIndex + ". ");
        name.setText(task.getName().getDisplayText());
        description.setText(task.getDescription().getDisplayText());
        time.setText(task.getTime().getDisplayText());
        date.setText(task.getDate().getDisplayText());
        venue.setText(task.getVenue().getDisplayText());
        priority.setText(task.getPriority().getDisplayText());
        tag.setText(task.getTag().getDisplayText());
        isFavorite.setText(task.getFavoriteText());
        isFinished.setText(task.getFinishedText());
        if (task.getDate().isPastDue()) {
            pastDue.setText("Past due!");
        } else {
            pastDue.setText("");
        }
        startTime.setText("");
        startDate.setText("");
        if (task instanceof Event) {
            startDate.setText(((Event) task).getStartDate().getStartDisplayText());
            startTime.setText(((Event) task).getStartTime().getStartDisplayText());
        }
        isRecurring.setText("");
        if (task.getRecurringProperty() == RecurringProperty.RECURRING) {
            assert task instanceof RecurringTask;
            RecurringMode mode = ((ReadOnlyRecurringTask) task).getMode();
            if (mode == RecurringMode.DAY) {
                isRecurring.setText("Everyday");
            } else if (mode == RecurringMode.MONTH) {
                isRecurring.setText("Every month");
            } else if (mode == RecurringMode.WEEK) {
                isRecurring.setText("Every week");
            }
        }
    }
}

@@ -201,16 +201,24 @@
 el.task.
+ReadOnly
 Event;%0Ai
@@ -275,77 +275,8 @@
 sk;%0A
-import seedu.address.model.task.ReadOnlyRecurringTask.RecurringMode;%0A
 impo
@@ -384,55 +384,8 @@
 rty;
-%0Aimport seedu.address.model.task.RecurringTask;
 %0A%0A/*
@@ -1995,16 +1995,24 @@
 tanceof 
+ReadOnly
 Event) %7B
@@ -2036,32 +2036,40 @@
 tDate.setText(((
+ReadOnly
 Event) task).get
@@ -2136,16 +2136,24 @@
 tText(((
+ReadOnly
 Event) t
@@ -2348,16 +2348,24 @@
 tanceof 
+ReadOnly
 Recurrin
@@ -2383,29 +2383,22 @@
         
-RecurringMode
+String
  mode = 
@@ -2435,333 +2435,65 @@
 .get
-Mode();%0A            if (mode == RecurringMode.DAY) %7B%0A                isRecurring.setText(%22Everyday%22);%0A            %7D else if (mode == RecurringMode.MONTH) %7B%0A                isRecurring.setText(%22Every month%22);%0A            %7D else if (mode == RecurringMode.WEEK) %7B%0A                isRecurring.setText(%22Every week%22);%0A            %7D
+RecurringPeriod();%0A            isRecurring.setText(mode);
 %0A   

Update task card