package tars.storage;

import tars.commons.exceptions.IllegalValueException;
import tars.model.task.*;
import tars.model.tag.Tag;
import tars.model.tag.UniqueTagList;

import javax.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.List;

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

    @XmlElement(required = true)
    private String name;
//    @XmlElement(required = true)
//    private String phone;
//    @XmlElement(required = true)
//    private String email;
//    @XmlElement(required = true)
//    private String address;

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

    /**
     * No-arg constructor for JAXB use.
     */
    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().taskName;
//        phone = source.getPhone().value;
//        email = source.getEmail().value;
//        address = source.getAddress().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 Phone phone = new Phone(this.phone);
//        final Email email = new Email(this.email);
//        final Address address = new Address(this.address);
//        final UniqueTagList tags = new UniqueTagList(taskTags);
        return new Task(name, null, null, null, null);
    }
}

@@ -389,24 +389,69 @@
 tring name;%0A
+    @XmlElement%0A    private String priority;%0A
 //    @XmlEl
@@ -630,18 +630,16 @@
 dress;%0A%0A
-//
     @Xml
@@ -646,18 +646,16 @@
 Element%0A
-//
     priv
@@ -1056,16 +1056,68 @@
 skName;%0A
+        priority = source.getPriority().toString();%0A
 //      
@@ -1233,34 +1233,32 @@
 ddress().value;%0A
-//
         tagged =
@@ -1269,34 +1269,32 @@
  ArrayList%3C%3E();%0A
-//
         for (Tag
@@ -1316,26 +1316,24 @@
 etTags()) %7B%0A
-//
             
@@ -1364,26 +1364,24 @@
 dTag(tag));%0A
-//
         %7D%0A  
@@ -1655,18 +1655,16 @@
 ption %7B%0A
-//
         
@@ -1705,26 +1705,24 @@
 ayList%3C%3E();%0A
-//
         for 
@@ -1752,18 +1752,16 @@
 gged) %7B%0A
-//
         
@@ -1797,18 +1797,16 @@
 ype());%0A
-//
         
@@ -1850,24 +1850,87 @@
 this.name);%0A
+        final Priority priority = new Priority(this.priority);%0A
 //        fi
@@ -2084,18 +2084,16 @@
 dress);%0A
-//
         
@@ -2184,28 +2184,32 @@
 , null, 
-null
+priority
 , null, 
 null);%0A 
@@ -2200,20 +2200,20 @@
 , null, 
-null
+tags
 );%0A    %7D

Add priority and tags element