/*
 * The MIT License
 *
 * Copyright (c) 2016 Marcelo "Ataxexe" Guimarães <ataxexe@devnull.tools>
 *
 * Permission  is hereby granted, free of charge, to any person obtaining
 * a  copy  of  this  software  and  associated  documentation files (the
 * "Software"),  to  deal  in the Software without restriction, including
 * without  limitation  the  rights to use, copy, modify, merge, publish,
 * distribute,  sublicense,  and/or  sell  copies of the Software, and to
 * permit  persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * The  above  copyright  notice  and  this  permission  notice  shall be
 * included  in  all  copies  or  substantial  portions  of the Software.
 *
 * THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY OF ANY KIND,
 * EXPRESS  OR  IMPLIED,  INCLUDING  BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN  NO  EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM,  DAMAGES  OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT  OR  OTHERWISE,  ARISING  FROM,  OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE   OR   THE   USE   OR   OTHER   DEALINGS  IN  THE  SOFTWARE.
 */

package tools.devnull.boteco.plugin;

/**
 * A class that represents command information for use by help interfaces.
 */
public class Command {

  private final String name;
  private final String description;

  /**
   * Creates a new Command object
   *
   * @param name        the name of the command
   * @param description the description of the command
   */
  public Command(String name, String description) {
    this.name = name;
    this.description = description;
  }

  /**
   * Returns the name of this command
   *
   * @return the name of this command
   */
  public String name() {
    return name;
  }

  /**
   * Returns the description of this command
   *
   * @return the description of this command
   */
  public String description() {
    return description;
  }

  /**
   * Creates a Command object using a component
   *
   * @param name the command name
   * @return a component for defining the description
   */
  public static CommandBuilder command(String name) {
    return description -> new Command(name, description);
  }

  /**
   * Interface for helping create Command objects
   */
  public interface CommandBuilder {

    /**
     * Defines what this command does when used
     *
     * @param description the description of the command
     * @return the created command object
     */
    Command does(String description);

  }

}

@@ -1279,16 +1279,108 @@
 lugin;%0A%0A
+import tools.devnull.boteco.BotException;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0A
 /**%0A * A
@@ -1542,16 +1542,53 @@
 ription;
+%0A  private final String%5B%5D parameters;
 %0A%0A  /**%0A
@@ -1721,32 +1721,86 @@
  of the command%0A
+   * @param parameters  the parameters of the command%0A
    */%0A  public C
@@ -1837,16 +1837,38 @@
 cription
+, String... parameters
 ) %7B%0A    
@@ -1913,32 +1913,66 @@
  = description;%0A
+    this.parameters = parameters;%0A
   %7D%0A%0A  /**%0A   * 
@@ -2283,364 +2283,1318 @@
   * 
-Creates a Command object using a component%0A   *%0A   * @param name the command name%0A   * @return a component for defining the description%0A   */%0A  public static CommandBuilder command(String name) %7B%0A    return description -%3E new Command(name, description);%0A  %7D%0A%0A  /**%0A   * Interface for helping create Command objects%0A   */%0A  public interface CommandBuilder %7B
+Returns a list of the parameters for this command.%0A   *%0A   * @return a list of the parameters for this command%0A   */%0A  public List%3CString%3E parameters() %7B%0A    return Arrays.asList(parameters);%0A  %7D%0A%0A  /**%0A   * Creates a Command object using a component%0A   *%0A   * @param name the command name%0A   * @return a component for defining the description%0A   */%0A  public static CommandBuilder command(String name) %7B%0A    return new CommandBuilder() %7B%0A      @Override%0A      public CommandBuilder with(String... parameters) %7B%0A        return new CommandBuilder() %7B%0A          @Override%0A          public CommandBuilder with(String... parameters) %7B%0A            throw new BotException(%22Parameters already defined%22);%0A          %7D%0A%0A          @Override%0A          public Command does(String description) %7B%0A            return new Command(name, description, parameters);%0A          %7D%0A        %7D;%0A      %7D%0A%0A      @Override%0A      public Command does(String description) %7B%0A        return new Command(name, description);%0A      %7D%0A    %7D;%0A  %7D%0A%0A  /**%0A   * Interface for helping create Command objects%0A   */%0A  public interface CommandBuilder %7B%0A%0A    /**%0A     * Defines the parameters of the command.%0A     *%0A     * @param parameters the parameters of the command%0A     * @return a builder instance%0A     */%0A    CommandBuilder with(String... parameters);
 %0A%0A  

add support for command parameters