package net.northking.cctp.common.exception;

/**
 * @author xiusong.xie
 * @since 1.0
 */
public enum ErrorEnum implements PlatformError
{
  FIRST(100000, "First"),
  DATA_SOURCE_NONE("无可用的数据源"),
  TOKEN_ERR("权限认证失败，令牌不合法"),
  METHOD_ARGUMENT_INVALID("数据验证失败，包含非法数据"),
  EXCEL_EXPORT("导出Excel失败"),
  EXCEL_IMPORT("导入Excel失败"),
  UNSUPPORTED_ENCODING("不支持的编码格式"),
  FILE_PATH_ERROR("无效的文件路径"),
  TREE_PARENT_NOT_EXIST("树形数据结构的上级节点不存在, id={0}, parentId={1}"),
  UNKNOWN("未知的异常。"),
  NOTICE_INSERT("创建通知失败"),
  APPLICATION_ENCODING_ERROR("程序编码指定错误"),
  ENTITY_NOT_FOUND("请求的数据不存在"),
  INVALID_PARAM("非法参数"),
  LAST(109999, "Last");

  private Integer code;
  private String msg;

  ErrorEnum(Integer code, String msg)
  {
    this.code = code;
    this.msg = msg;
  }

  ErrorEnum(String msg)
  {
    this.code = ordinal() + START_CODE;
    this.msg = msg;
  }

  private static final int START_CODE = 100000;

  public Integer getCode()
  {
    return code;
  }

  public String getMsg()
  {
    return code + ": " + msg;
  }


}
