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 =
            "The length of a task name should not be longer than 45 characters, and it should not be blank";
    public static final String EMPTY_STRING = "";
    public static final int MAX_LENGTH = 45;
    

    /*
     * The first character of the information must not be a whitespace,
     * otherwise " " (a blank string) becomes a valid input.
     */

    public final String fullName;

    //@author A0144904H
    /**
     * 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.
     */
    //@@author A0147990R
    public static boolean isValidName(String test) {
        return (!test.equals(EMPTY_STRING)) && test.length() <= MAX_LENGTH;
    }

    //@@author
    @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();
    }

}

@@ -243,16 +243,61 @@
 Name %7B%0A%0A
+    public static final int MAX_LENGTH = 45;%0A
     publ
@@ -411,18 +411,46 @@
 er than 
-45
+%22 + MAX_LENGTH%0A            + %22
  charact
@@ -537,57 +537,8 @@
 %22%22;%0A
-    public static final int MAX_LENGTH = 45;%0A    
 %0A%0A  

update message name constraints