package seedu.tache.storage;

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

import javax.xml.bind.annotation.XmlElement;

import seedu.tache.commons.exceptions.IllegalValueException;
import seedu.tache.model.tag.Tag;
import seedu.tache.model.tag.UniqueTagList;
import seedu.tache.model.task.DateTime;
import seedu.tache.model.task.Name;
import seedu.tache.model.task.ReadOnlyTask;
import seedu.tache.model.task.Task;
import seedu.tache.model.task.Task.RecurInterval;

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

    @XmlElement(required = true)
    private String name;
    
    @XmlElement(required = false)
    private String startDateTime;
    
    @XmlElement(required = false)
    private String endDateTime;
    
    @XmlElement(required = false)
    private boolean isActive;
    
    @XmlElement(required = false)
    private boolean isTimed;
    
    @XmlElement(required = false)
    private boolean isRecurring;

    @XmlElement(required = false)
    private RecurInterval interval;
    
    @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;
        startDateTime = source.getStartDateTime().toString();
        endDateTime = source.getEndDateTime().toString();
        isActive = source.getActiveStatus();
        isTimed = source.getTimedStatus();
        isRecurring = source.getRecurringStatus();
        interval = source.getRecurInterval();
        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 Optional<DateTime> startDateTime;
        if(this.startDateTime != null && !(this.startDateTime.equals("Optional.empty"))) {
            startDateTime = Optional.of(new DateTime(this.startDateTime));
        } else {
            startDateTime = Optional.empty();
        }
        final Optional<DateTime> endDateTime;
        if(this.endDateTime != null && !(this.endDateTime.equals("Optional.empty"))) {
            endDateTime = Optional.of(new DateTime(this.endDateTime));
        } else {
            endDateTime = Optional.empty();
        }
        final boolean isActive = this.isActive;
        final boolean isTimed = this.isTimed;
        final boolean isRecurring = this.isRecurring;
        final RecurInterval interval = this.interval;
        final UniqueTagList tags = new UniqueTagList(taskTags);
        return new Task(name, startDateTime, endDateTime, tags, isTimed, isActive, isRecurring, interval);
    }
}

@@ -625,29 +625,25 @@
 tring name;%0A
-    
 %0A
+
     @XmlElem
@@ -690,37 +690,33 @@
  startDateTime;%0A
-    
 %0A
+
     @XmlElement(
@@ -765,21 +765,17 @@
 teTime;%0A
-    
 %0A
+
     @Xml
@@ -830,21 +830,17 @@
 Active;%0A
-    
 %0A
+
     @Xml
@@ -894,21 +894,17 @@
 sTimed;%0A
-    
 %0A
+
     @Xml
@@ -1033,20 +1033,16 @@
 terval;%0A
-    
 %0A    @Xm
@@ -2493,24 +2493,25 @@
 ;%0A        if
+ 
 (this.startD
@@ -2783,16 +2783,17 @@
       if
+ 
 (this.en

Fix Checkstyle Violations