package seedu.task.storage;

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

import javax.xml.bind.annotation.XmlElement;

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

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

    @XmlElement(required = true)
    private String description;

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

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


    /**
     * Converts a given Person into this class for JAXB use.
     *
     * @param source future changes to this will not affect the created XmlAdaptedPerson
     */
    public XmlAdaptedTask(ReadOnlyTask source) {
        description = source.getName().fullName;
        tagged = new ArrayList<>();
        for (Tag tag : source.getTags()) {
            tagged.add(new XmlAdaptedTag(tag));
        }
    }

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

@@ -406,22 +406,20 @@
  of the 
-Person
+Task
 .%0A */%0Apu
@@ -629,22 +629,20 @@
 lAdapted
-Person
+Task
 .%0A     *
@@ -772,22 +772,20 @@
 a given 
-Person
+Task
  into th
@@ -896,22 +896,20 @@
 lAdapted
-Person
+Task
 %0A     */
@@ -1202,22 +1202,20 @@
 adapted 
-person
+task
  object 
@@ -1235,14 +1235,12 @@
 l's 
-Person
+Task
  obj
@@ -1347,22 +1347,20 @@
 adapted 
-person
+task
 %0A     */
@@ -1445,22 +1445,20 @@
 st%3CTag%3E 
-person
+task
 Tags = n
@@ -1530,22 +1530,20 @@
         
-person
+task
 Tags.add
@@ -1684,14 +1684,12 @@
 ist(
-person
+task
 Tags

Update XmlAdaptedTask comments