package seedu.tache.logic.commands;

import seedu.tache.commons.core.Messages;
import seedu.tache.commons.core.UnmodifiableObservableList;
import seedu.tache.logic.commands.exceptions.CommandException;
import seedu.tache.model.person.ReadOnlyPerson;
import seedu.tache.model.person.UniquePersonList.PersonNotFoundException;

/**
 * Deletes a person identified using it's last displayed index from the address book.
 */
public class DeleteCommand extends Command {

    public static final String COMMAND_WORD = "delete";

    public static final String MESSAGE_USAGE = COMMAND_WORD
            + ": Deletes the person identified by the index number used in the last person listing.\n"
            + "Parameters: INDEX (must be a positive integer)\n"
            + "Example: " + COMMAND_WORD + " 1";

    public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted Person: %1$s";

    public final int targetIndex;

    public DeleteCommand(int targetIndex) {
        this.targetIndex = targetIndex;
    }


    @Override
    public CommandResult execute() throws CommandException {

        UnmodifiableObservableList<ReadOnlyPerson> lastShownList = model.getFilteredPersonList();

        if (lastShownList.size() < targetIndex) {
            throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
        }

        ReadOnlyPerson personToDelete = lastShownList.get(targetIndex - 1);

        try {
            model.deletePerson(personToDelete);
        } catch (PersonNotFoundException pnfe) {
            assert false : "The target person cannot be missing";
        }

        return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, personToDelete));
    }

}

@@ -235,22 +235,20 @@
 ReadOnly
-Person
+Task
 ;%0Aimport
@@ -283,25 +283,21 @@
 ique
-PersonList.Person
+TaskList.Task
 NotF
@@ -329,22 +329,20 @@
 letes a 
-person
+task
  identif
@@ -390,20 +390,20 @@
 the 
-address book
+task manager
 .%0A *
@@ -596,22 +596,20 @@
 tes the 
-person
+task
  identif
@@ -821,38 +821,36 @@
  MESSAGE_DELETE_
-PERSON
+TASK
 _SUCCESS = %22Dele
@@ -853,22 +853,20 @@
 Deleted 
-Person
+Task
 : %251$s%22;
@@ -1113,22 +1113,20 @@
 ReadOnly
-Person
+Task
 %3E lastSh
@@ -1152,22 +1152,20 @@
 Filtered
-Person
+Task
 List();%0A
@@ -1279,22 +1279,20 @@
 INVALID_
-PERSON
+TASK
 _DISPLAY
@@ -1333,21 +1333,17 @@
 Only
-Person person
+Task task
 ToDe
@@ -1428,21 +1428,17 @@
 lete
-Person(person
+Task(task
 ToDe
@@ -1465,14 +1465,12 @@
 ch (
-Person
+Task
 NotF
@@ -1483,17 +1483,17 @@
 ception 
-p
+t
 nfe) %7B%0A 
@@ -1530,22 +1530,20 @@
  target 
-person
+task
  cannot 
@@ -1632,14 +1632,12 @@
 ETE_
-PERSON
+TASK
 _SUC
@@ -1642,22 +1642,20 @@
 UCCESS, 
-person
+task
 ToDelete

Delete Command that uses Task and DetailedTask classes