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 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.
     */
    public static boolean isValidName(String test) {
        return !test.equals(EMPTY_STRING);
    }

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

}

@@ -315,24 +315,40 @@
       %22T
+he length of a t
 ask name
 s should
@@ -343,17 +343,16 @@
 name
-s
  should 
 only
@@ -351,91 +351,39 @@
 uld 
-only contain alphanumeric characters,%22%0A            + %22 special characters and space
+not be longer than 45 character
 s, a
@@ -459,16 +459,66 @@
 NG = %22%22;
+%0A    public static final int MAX_LENGTH = 45;%0A    
 %0A%0A    /*
@@ -1206,32 +1206,57 @@
 k name.%0A     */%0A
+    //@@author A0147990R%0A
     public stati
@@ -1307,16 +1307,17 @@
  return 
+(
 !test.eq
@@ -1334,16 +1334,48 @@
 _STRING)
+) && test.length() %3C= MAX_LENGTH
 ;%0A    %7D%0A

add name length constraints