package seedu.taskboss.model.task;

import seedu.taskboss.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in TaskBoss.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS =
            "Task names should only contain alphanumeric characters,"
            + " special characters and spaces, and it should not be blank";
    public static final String EMPTY_STRING = "";

    /*
     * The first character of the information must not be a whitespace,
     * otherwise " " (a blank string) becomes a valid input.
     */
//    public static final String NAME_VALIDATION_REGEX = "[\\p{Alnum}][\\p{Alnum}|\\s|!|"
//            + "|_|-|+|$|#|@|%|^|*|?+/||<|>|`|~|&]*";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        String trimmedName = name.trim();
        if (!isValidName(trimmedName)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = trimmedName;
    }

    /**
     * Returns true if a given string is a valid task name.
     */
    public static boolean isValidName(String test) {
        return !test.equals(EMPTY_STRING);
    }


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

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

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

}

@@ -646,18 +646,17 @@
      */%0A
-//
+%0A
     publ
@@ -650,39 +650,32 @@
  */%0A%0A    public 
-static 
 final String NAM
@@ -675,155 +675,42 @@
 ing 
-NAME_VALIDATION_REGEX = %22%5B%5C%5Cp%7BAlnum%7D%5D%5B%5C%5Cp%7BAlnum%7D%7C%5C%5Cs%7C!%7C%22%0A//            + %22%7C_%7C-%7C+%7C$%7C#%7C@%7C%25%7C%5E%7C*%7C?+/%7C%7C%3C%7C%3E%7C%60%7C~%7C&%5D*%22;%0A%0A    public final String fullName;%0A
+fullName;%0A%0A    //@author A0144904H
 %0A   
@@ -1304,16 +1304,40 @@
 %0A    %7D%0A%0A
+    //@@author A0144904H
 %0A    @Ov

collate name