@Nullable
      private PsiClass createTemplate(JVMElementFactory factory, String name) {
        return switch (getType()) {
          case ENUM -> factory.createEnum(name);
          case TRAIT -> {
            if (factory instanceof GroovyPsiElementFactory groovyFactory) {
              yield groovyFactory.createTrait(name);
            }
            yield null;
          }
          case CLASS -> factory.createClass(name);
          case INTERFACE -> factory.createInterface(name);
          case ANNOTATION -> factory.createAnnotationType(name);
          case RECORD -> {
            if (factory instanceof GroovyPsiElementFactory groovyFactory) {
              yield groovyFactory.createRecord(name);
            }
            yield null;
          }
        };
      }
@Nullable
      private PsiClass createTemplate(JVMElementFactory factory, String name)