package seedu.oneline.model.tag;

import seedu.oneline.commons.exceptions.IllegalValueException;
import seedu.oneline.model.task.TaskName;

public class TagColor {

    public static final String EMPTY_COLOR_VALUE = "";
    
    private String value;
    
    public static final String MESSAGE_COLOR_CONSTRAINTS = "Valid colors: <red, blue, green>";
    
    public TagColor(String color) throws IllegalValueException {
        if (!isValidColor(color)) {
            throw new IllegalValueException(MESSAGE_COLOR_CONSTRAINTS);
        }
        this.value = color;
    }
    
    public static boolean isValidColor(String color) {
        return true;
    }
    
    public static TagColor getDefault() {
        try {
            return new TagColor(EMPTY_COLOR_VALUE);
        } catch (IllegalValueException e) {
            assert false; // This function should return a correct value!
        }
        return null;
    }
    
    /**
     * Serialize field for storage
     */
    public String serialize() {
        return value;
    }
    
    /**
     * Deserialize from storage
     */
    public static TagColor deserialize(String args) throws IllegalValueException {
        return new TagColor(args);
    }
    
    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof TagColor // instanceof handles nulls
                && this.value.equals(((TagColor) other).value)); // state check
    }
    
    public String toString() {
        return value;
    }
    
    public String toHTMLColor() {
        return value;
    }
    
}

@@ -27,16 +27,43 @@
 l.tag;%0A%0A
+import java.util.HashMap; %0A
 import s
@@ -160,16 +160,17 @@
 kName;%0A%0A
+%0A
 public c
@@ -268,24 +268,389 @@
 ring value;%0A
+    private static final HashMap%3CString, String%3E colorValues = new HashMap%3CString, String%3E() %7B%7B%0A        put(%22%22, %22#FFFFFF%22);%0A        put(%22white%22, %22#FFFFFF%22);%0A        put(%22red%22, %22#FF9D93%22);%0A        put(%22orange%22, %22#FFBE76%22);%0A        put(%22yellow%22, %22#FFEE90%22); %0A        put(%22green%22, %22#B2EA76%22);%0A        put(%22blue%22, %22#AAC3E2%22);%0A        put(%22purple%22, %22#CAB8DF%22);%0A    %7D%7D; %0A
     %0A    pub
@@ -721,24 +721,55 @@
 s: %3C
-red, blue, green
+white, red, orange, yellow, green, blue, purple
 %3E%22;%0A
@@ -1069,12 +1069,38 @@
 urn 
-true
+colorValues.containsKey(color)
 ;%0A  
@@ -2056,36 +2056,53 @@
 %0A        return 
+colorValues.get(
 value
+)
 ;%0A    %7D%0A    %0A%7D%0A

Set tag colors