package seedu.ezdo.storage;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;

import seedu.ezdo.commons.exceptions.IllegalValueException;
import seedu.ezdo.model.tag.Tag;
import seedu.ezdo.model.tag.UniqueTagList;
import seedu.ezdo.model.todo.Email;
import seedu.ezdo.model.todo.Name;
import seedu.ezdo.model.todo.Priority;
import seedu.ezdo.model.todo.ReadOnlyTask;
import seedu.ezdo.model.todo.StartDate;
import seedu.ezdo.model.todo.Task;

/**
 * JAXB-friendly version of the Task.
 */
public class XmlAdaptedTask {

    @XmlElement(required = true)
    private String name;
    @XmlElement(required = true)
    private String priority;
    @XmlElement(required = true)
    private String email;
    @XmlElement(required = true)
    private String startDate;

    @XmlElement
    private List<XmlAdaptedTag> tagged = new ArrayList<>();

    /**
     * Constructs an XmlAdaptedTask.
     * This is the no-arg constructor that is required by JAXB.
     */
    public XmlAdaptedTask() {}


    /**
     * Converts a given Task into this class for JAXB use.
     *
     * @param source future changes to this will not affect the created XmlAdaptedTask
     */
    public XmlAdaptedTask(ReadOnlyTask source) {
        name = source.getName().fullName;
        priority = source.getPriority().value;
        email = source.getEmail().value;
        startDate = source.getStartDate().value;
        tagged = new ArrayList<>();
        for (Tag tag : source.getTags()) {
            tagged.add(new XmlAdaptedTag(tag));
        }
    }

    /**
     * Converts this jaxb-friendly adapted task object into the model's Task object.
     *
     * @throws IllegalValueException if there were any data constraints violated in the adapted task
     */
    public Task toModelType() throws IllegalValueException {
        final List<Tag> taskTags = new ArrayList<>();
        for (XmlAdaptedTag tag : tagged) {
            taskTags.add(tag.toModelType());
        }
        final Name name = new Name(this.name);
        final Priority priority = new Priority(this.priority);
        final Email email = new Email(this.email);
        final StartDate startDate = new StartDate(this.startDate);
        final UniqueTagList tags = new UniqueTagList(taskTags);
        return new Task(name, priority, email, startDate, tags);
    }
}

@@ -252,24 +252,62 @@
 queTagList;%0A
+import seedu.ezdo.model.todo.DueDate;%0A
 import seedu
@@ -841,16 +841,77 @@
 artDate;
+%0A    @XmlElement(required = true)%0A    private String dueDate;
 %0A%0A    @X
@@ -2318,24 +2318,83 @@
 startDate);%0A
+        final DueDate dueDate = new DueDate(this.dueDate);%0A
         fina
@@ -2502,16 +2502,25 @@
 artDate,
+ dueDate,
  tags);%0A

Add DueDate object in toModelType() method; Update DueDate in Task constructor