package seedu.taskmanager.model.item;

import seedu.taskmanager.commons.exceptions.IllegalValueException;

/**
 * Represents a Item's type in the task manager.
 */
public class ItemType {

	public static final String EVENT_WORD = "event";
	public static final String DEADLINE_WORD = "deadline";
	public static final String TASK_WORD = "task";
	
    public static final String MESSAGE_ITEM_TYPE_CONSTRAINTS = "Item types should only be 'task', 'deadline' or 'event'.";
    public static final String ITEMTYPE_VALIDATION_REGEX = EVENT_WORD + "|" + DEADLINE_WORD + "|" + TASK_WORD;

    public final String value;

    /**
     * Validates given item type.
     *
     * @throws IllegalValueException if given itemType string is invalid.
     */
    public ItemType(String itemType) throws IllegalValueException {
        assert itemType != null;
        itemType = itemType.trim();
        if (!isValidItemType(itemType.toLowerCase())) {
            throw new IllegalValueException(MESSAGE_ITEM_TYPE_CONSTRAINTS);
        }
        this.value = itemType;
    }

    /**
     * Returns true if a given string is a valid item type.
     */
    public static boolean isValidItemType(String test) {
        return test.matches(ITEMTYPE_VALIDATION_REGEX);
    }


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

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

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

}

@@ -604,16 +604,45 @@
  value;%0A
+    %0A    //@@author A0140060A
 %0A    /**
@@ -1278,16 +1278,457 @@
 %0A    %7D%0A%0A
+    /**%0A     * Returns true if item type is 'task'.%0A     */%0A    public boolean isATask() %7B%0A        return value.equals(TASK_WORD);%0A    %7D%0A    %0A    /**%0A     * Returns true if item type is 'event'.%0A     */%0A    public boolean isAnEvent() %7B%0A        return value.equals(EVENT_WORD);%0A    %7D%0A    %0A    /**%0A     * Returns true if item type is 'deadline'.%0A     */%0A    public boolean isADeadline() %7B%0A        return value.equals(DEADLINE_WORD);%0A    %7D%0A    
 %0A    @Ov

Add convenience methods for checking of item type