package seedu.malitio.storage;

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

import javax.xml.bind.annotation.XmlElement;

import seedu.malitio.commons.exceptions.IllegalValueException;
import seedu.malitio.model.tag.Tag;
import seedu.malitio.model.tag.UniqueTagList;
import seedu.malitio.model.task.DateTime;
import seedu.malitio.model.task.Deadlines;
import seedu.malitio.model.task.Events;
import seedu.malitio.model.task.Name;
import seedu.malitio.model.task.ReadOnlySchedule;
import seedu.malitio.model.task.Schedule;

public class XmlAdaptedSchedule {

    @XmlElement(required = true)
    private String name;


    @XmlElement
    private String due; //Not used yet.
    private String start;
    private String end;
    private List<XmlAdaptedTag> tagged = new ArrayList<>();

    /**
     * No-arg constructor for JAXB use.
     */
    public XmlAdaptedSchedule() {}


    /**
     * Converts a given Schedule into this class for JAXB use.
     *
     * @param source future changes to this will not affect the created XmlAdaptedTask
     */
    public XmlAdaptedSchedule(ReadOnlySchedule source) {
        name = source.getName().fullName;
        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 Schedule toModelType() throws IllegalValueException {
        final List<Tag> taskTags = new ArrayList<>();
        for (XmlAdaptedTag tag : tagged) {
            taskTags.add(tag.toModelType());
        }
        if (start == null) {
            final Name name = new Name(this.name);
            final DateTime due = new DateTime(this.due);
            final UniqueTagList tags = new UniqueTagList(taskTags);
            return new Deadlines(name, due, tags);
        }
        else {
            final Name name = new Name(this.name);
            final DateTime start = new DateTime(this.start);
            final DateTime end = new DateTime(this.end);
            final UniqueTagList tags = new UniqueTagList(taskTags);
            return new Events(name, start, end , tags);
        }
    }
}

@@ -663,23 +663,8 @@
 ue; 
-//Not used yet.
 %0A   
@@ -1710,41 +1710,8 @@
   %7D%0A
-        if (start == null) %7B%0A    
     
@@ -1757,69 +1757,8 @@
 e);%0A
-            final DateTime due = new DateTime(this.due);%0A    
     
@@ -1844,363 +1844,28 @@
 new 
-Deadlines(name, due, tags);%0A        %7D%0A        else %7B%0A            final Name name = new Name(this.name);%0A            final DateTime start = new DateTime(this.start);%0A            final DateTime end = new DateTime(this.end);%0A            final UniqueTagList tags = new UniqueTagList(taskTags);%0A            return new Events(name, start, end , tags);%0A        %7D
+Schedule(name,tags);
 %0A   

Change XmlAdaptedSchedule to return a Schedule Object with Name and Tags. This is a wrong implementation but it shows that the Schedule list can display and store objects independently of the task list.