package seedu.address.model.task;

import seedu.address.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's priority number in the address book.
 * Guarantees: immutable; is valid as declared in {@link #isValidPriority(String)}
 */
public class Priority {

    public static final String MESSAGE_PRIORITY_CONSTRAINTS = "Task priority should be between 1-3";

    public final String value;

    /**
     * Validates given priority number.
     *
     * @throws IllegalValueException if given phone string is invalid.
     */
    public Priority(String priority) throws IllegalValueException {
        if (priority != null) {
            String trimmedPriority = priority.trim();
            if (!isValidPriority(trimmedPriority)) {
                throw new IllegalValueException(MESSAGE_PRIORITY_CONSTRAINTS);
            }
            this.value = trimmedPriority;
        } else {
            this.value = null;
        }
    }

    /**
     * Returns true if a given string is a valid task priority.
     */
    public static boolean isValidPriority(String test) {
        return (test.equals("1") || test.equals("2") || test.equals("3"));
    }

    @Override
    public String toString() {
        return value;
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Priority // instanceof handles nulls
                && this.value.equals(((Priority) other).value)); // state check
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }

}

@@ -265,16 +265,47 @@
 riority 
+implements Comparable%3CPriority%3E
 %7B%0A%0A    p
@@ -1627,10 +1627,243 @@
 %0A    %7D%0A%0A
+    @Override%0A    public int compareTo(Priority comparePriority) %7B%0A        int thisValue = Integer.parseInt(this.value);%0A        int otherValue = Integer.parseInt(comparePriority.value);%0A        return thisValue - otherValue;%0A    %7D%0A%0A
 %7D%0A

implement Comparable in Priority.java