package net.northking.cctp.maven.gen;

/**
 * 代码生成任务枚举
 *
 * @author xiusong.xie
 * @since 1.0
 */
public enum GenCodeTaskEnum
{
  ENTITY(".java", true, "pojo/entity.vm", Constants.PACKAGE_ENTITY, "java", false),
  JPA_ENTITY(".java", true, "pojo/JpaEntity.vm", Constants.PACKAGE_ENTITY, "java", false),
  JPA("Repository.java", false, "dao/jpa.vm", Constants.PACKAGE_JAP, "java", false),
  MAPPER("Mapper.java", true, "dao/mapper.vm", Constants.PACKAGE_MYBATIS_MAPPER, "java", false),
  MAPPER_XML(".Mapper.xml", true, "dao/mapperXml.vm", "mybatis/base/", "resource", false),
  DAO("Dao.java", false, "dao/dao.vm", Constants.PACKAGE_MYBATIS_DAO, "java", false),
  DAO_XML(".Dao.xml", false, "dao/daoXml.vm", "mybatis/ext/", "resource", false),
  SERVICE("Service.java", false, "service/service.vm", Constants.PACKAGE_MYBATIS_SERVICE, "java", false),
  SERVICE_IMPL("ServiceImpl.java", false, "service/serviceImpl.vm", Constants.PACKAGE_MYBATIS_IMPL, "java", false),

  API_RESTFUL("RestfulCtrl.java", true, "api/restful-ctrl.vm", Constants.PACKAGE_GEN_CODE, "java", true),
  API_QUERY("QueryCtrl.java", true, "api/query-ctrl.vm", Constants.PACKAGE_GEN_CODE, "java", true),
  API_BATCH("BatchCtrl.java", true, "api/batch-ctrl.vm", Constants.PACKAGE_GEN_CODE, "java", true),

  API_DTO_ADD("AddDto.java", true, "api/restful-dto-add.vm", Constants.PACKAGE_GEN_CODE, "java", true),
  API_DTO_UPDATE("UpdateDto.java", true, "api/restful-dto-update.vm", Constants.PACKAGE_GEN_CODE, "java", true),
  API_DTO_QUERY("QueryDto.java", true, "api/restful-dto-query.vm", Constants.PACKAGE_GEN_CODE, "java", true),
  API_DTO_DETAIL("DetailDto.java", true, "api/restful-dto-detail.vm", Constants.PACKAGE_GEN_CODE, "java", true),

  API_SERVICE("ApiService.java", true, "api/api-service.vm", Constants.PACKAGE_GEN_CODE, "java", true),
  API_SERVICE_IMPL("ApiServiceImpl.java", true, "api/api-service-impl.vm", Constants.PACKAGE_GEN_CODE, "java", true),

  TENANT_ENTITY(".java", true, "pojo/entity-tenant.vm", Constants.PACKAGE_ENTITY, "java", false),
  TENANT_MAPPER_XML(".Mapper.xml", true, "dao/mapperXml-tenant.vm", "mybatis/base/", "resource", false),
  TENANT_SERVICE_IMPL("ServiceImpl.java", false, "service/serviceImpl-tenant.vm", Constants.PACKAGE_MYBATIS_IMPL, "java", false),
  TENANT_JPA_ENTITY(".java", true, "pojo/JpaEntity-tenant.vm", Constants.PACKAGE_ENTITY, "java", false),
  TENANT_JPA("Repository.java", false, "dao/jpa-tenant.vm", Constants.PACKAGE_JAP, "java", false),

  DTO("Dto.java", true, "dto/dto.vm", Constants.PACKAGE_DTO, "java", false),

  VUE_ENTITY_JS(".js", true, "vue/entity.js.vm", "html/", "html", true),
  VUE_INDEX("List.vue", true, "vue/index.vue.vm", "html/", "html", true),
  VUE_ADD("Add.vue", true, "vue/add.vue.vm", "html/", "html", true),
  VUE_EDIT("Edit.vue", true, "vue/edit.vue.vm", "html/", "html", true),
  VUE_ROUTER("Router.js", true, "vue/router.js.vm", "html/", "html", true),
  VUE_DETAIL("Detail.vue", true, "vue/detail.vue.vm", "html/", "html", true),

  END(".END", true, "", "", "end", false);

  /**
   * 后缀名
   */
  private String postfix;
  /**
   * 是否重写/覆盖
   */
  private boolean override;
  /**
   * 源代码VM模板
   */
  private String vmTemplate;
  /**
   * 源代码输出目录
   */
  private String pathName;

  /**
   * 文件类型
   */
  private String type;

  /**
   * java包是否使用子文件夹
   */
  private boolean subPackage;


  GenCodeTaskEnum(String postfix, boolean override, String vmTemplate, String pathName, String type, boolean subPackage)
  {
    this.postfix = postfix;
    this.override = override;
    this.vmTemplate = vmTemplate;
    this.pathName = pathName;
    this.type = type;
    this.subPackage = subPackage;
  }

  public String getPostfix()
  {
    return postfix;
  }

  public boolean isOverride()
  {
    return override;
  }

  public String getVmTemplate()
  {
    return vmTemplate;
  }

  public String getPathName()
  {
    return pathName;
  }

  public String getType()
  {
    return type;
  }

  public boolean isSubPackage()
  {
    return subPackage;
  }
}
