/*
** Module   : ExitCode.java
** Abstract : encodes all possible command line exit codes
**
** Copyright (c) 2009-2013, Golden Code Development Corporation.
**
** -#- -I- --Date-- ---------------------------------Description----------------------------------
** 001 GES 20090198 Encodes all possible command line exit codes.
** 002 CA  20130410 Added UNINITIALIZED_VARIABLE and VARIABLE_READ_ERROR.
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.goldencode.harness;

/**
 * Encodes all possible command line exit codes.
 */
public enum ExitCode
{
   PASSED(0, "All tests passed."),
   FAILED(-1, "At least 1 test failed."),
   MISSING_FILENAME(-2, "No filename was specified."),
   INVALID_FILENAME(-3, "Resource does not exist or is not a file."),
   INVALID_PATHNAME(-4, "Path cannot be created."),
   MISSING_CONTENT(-5, "Cannot load file (missing content)."),
   INVALID_CONTENT(-6, "Cannot load file (bad content)."),
   MISSING_OPTION_DATA(-7, "Command line option requires additional data."),
   INVALID_OPTION(-8, "Invalid command line option."),
   CONNECT_FAILURE(-9, "Cannot connect."),
   UNKNOWN_FAILURE(-10, "Unexpected problem occurred."),
   UNINITIALIZED_VARIABLE(-11, "Uninitialized variable."),
   VARIABLE_READ_ERROR(-12, "Error reading variable.");
   
   /** Exit code value. */
   private int code = 0;
   
   /** Descriptive text. */
   private String descr = null;
   
   /**
    * Define a new instance with a specific exit code value.
    *
    * @param    code
    *           The exit code associated with the given status.
    * @param    descr
    *           Descriptive text to explain the code.
    */
   private ExitCode(int code, String descr)
   {
      this.code  = code;
      this.descr = descr;
   }
   
   /**
    * Get the exit code for this instance.
    *
    * @return   The exit code.
    */
   public int getCode()
   {
      return code;
   }
   
   /**
    * Get the description for this instance.
    *
    * @return   The descriptive text.
    */
   public String getDescription()
   {
      return descr;
   }
}
