package com.l7tech.external.assertions.gatewaygraphql.server.resolver.mutation;

import com.l7tech.external.assertions.gatewaygraphql.EntityTypeInfo;
import com.l7tech.external.assertions.gatewaygraphql.server.data.EntityDTO;
import com.l7tech.external.assertions.gatewaygraphql.server.data.EntityMappingInstruction;
import com.l7tech.external.assertions.gatewaygraphql.server.input.EntityInput;
import com.l7tech.external.assertions.gatewaygraphql.server.input.EntityRefInput;
import com.l7tech.external.assertions.gatewaygraphql.server.resolver.transformer.ResolverTransformer;
import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.FindException;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.jetbrains.annotations.Nullable;
import org.springframework.transaction.PlatformTransactionManager;

public abstract class EntityAwareGraphQLMutationResolver2<ET extends Entity, EO extends EntityDTO<ET>, EI extends EntityInput, ERI extends EntityRefInput>
   extends EntityAwareGraphQLMutationResolver<ET, EO, EI> {
   private final ResolverTransformer<ET, EO, EI> b;

   protected EntityAwareGraphQLMutationResolver2(EntityTypeInfo var1, PlatformTransactionManager var2, ResolverTransformer<ET, EO, EI> var3) {
      super(var1, var2);
      this.b = var3;
   }

   @Override
   protected ET toEntity(EI var1) {
      return this.b.toEntity((EI)var1);
   }

   @Override
   protected EO toEntityDTO(ET var1) {
      return this.b.toEntityDTO((ET)var1);
   }

   @Override
   protected EI toEntityInput(EntityMappingInstruction var1) {
      return this.b.toEntityInput(var1);
   }

   @Override
   protected EI toEntityInput(Object var1) {
      return this.toEntityInput(this.toEntityMappingInstruction(var1));
   }

   @Override
   protected Map<String, Object> toRawEntity(@Nullable EI var1) {
      return this.b.toRawEntity((EI)var1);
   }

   @Override
   protected void setEntity(EI var1, ET var2) {
      this.b.setEntity((EI)var1, (ET)var2);
   }

   @Override
   protected void setEntityConditionally(EI var1, ET var2) {
      this.b.setPartialEntity((EI)var1, (ET)var2);
   }

   @Override
   protected void resetEntitySelectively(EI var1, ET var2) {
      this.b.presetEntity((EI)var1, (ET)var2);
   }

   @Override
   protected void resetEntityConditionally(EI var1, ET var2) {
      this.b.presetPartialEntity((EI)var1, (ET)var2);
   }

   protected abstract ET findByRefInput(ERI var1) throws FindException;

   protected Collection<ET> findMultipleByRefInput(ERI var1) throws FindException {
      return Collections.emptyList();
   }

   @Override
   protected final ET findBy(EI param1, AtomicBoolean param2) throws FindException {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 00: aload 1
      // 01: invokevirtual com/l7tech/external/assertions/gatewaygraphql/server/input/EntityInput.getRefInput ()Lcom/l7tech/external/assertions/gatewaygraphql/server/input/EntityRefInput;
      // 04: astore 3
      // 05: aload 0
      // 06: invokevirtual com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.isFindMultipleEnabled ()Z
      // 09: ifeq 65
      // 0c: aload 3
      // 0d: ifnull 23
      // 10: goto 17
      // 13: invokestatic com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.a (Lcom/l7tech/objectmodel/FindException;)Lcom/l7tech/objectmodel/FindException;
      // 16: athrow
      // 17: aload 0
      // 18: aload 3
      // 19: invokevirtual com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.findMultipleByRefInput (Lcom/l7tech/external/assertions/gatewaygraphql/server/input/EntityRefInput;)Ljava/util/Collection;
      // 1c: goto 28
      // 1f: invokestatic com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.a (Lcom/l7tech/objectmodel/FindException;)Lcom/l7tech/objectmodel/FindException;
      // 22: athrow
      // 23: aload 0
      // 24: aload 1
      // 25: invokevirtual com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.findMultipleByInput (Lcom/l7tech/external/assertions/gatewaygraphql/server/input/EntityInput;)Ljava/util/Collection;
      // 28: astore 4
      // 2a: aload 2
      // 2b: aload 4
      // 2d: invokeinterface java/util/Collection.size ()I 1
      // 32: bipush 1
      // 33: if_icmple 3e
      // 36: bipush 1
      // 37: goto 3f
      // 3a: invokestatic com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.a (Lcom/l7tech/objectmodel/FindException;)Lcom/l7tech/objectmodel/FindException;
      // 3d: athrow
      // 3e: bipush 0
      // 3f: invokevirtual java/util/concurrent/atomic/AtomicBoolean.set (Z)V
      // 42: aload 4
      // 44: invokeinterface java/util/Collection.size ()I 1
      // 49: bipush 1
      // 4a: if_icmpne 63
      // 4d: aload 4
      // 4f: invokeinterface java/util/Collection.iterator ()Ljava/util/Iterator; 1
      // 54: invokeinterface java/util/Iterator.next ()Ljava/lang/Object; 1
      // 59: checkcast com/l7tech/objectmodel/Entity
      // 5c: goto 64
      // 5f: invokestatic com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.a (Lcom/l7tech/objectmodel/FindException;)Lcom/l7tech/objectmodel/FindException;
      // 62: athrow
      // 63: aconst_null
      // 64: areturn
      // 65: aload 3
      // 66: ifnull 75
      // 69: aload 0
      // 6a: aload 3
      // 6b: invokevirtual com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.findByRefInput (Lcom/l7tech/external/assertions/gatewaygraphql/server/input/EntityRefInput;)Lcom/l7tech/objectmodel/Entity;
      // 6e: goto 7a
      // 71: invokestatic com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.a (Lcom/l7tech/objectmodel/FindException;)Lcom/l7tech/objectmodel/FindException;
      // 74: athrow
      // 75: aload 0
      // 76: aload 1
      // 77: invokevirtual com/l7tech/external/assertions/gatewaygraphql/server/resolver/mutation/EntityAwareGraphQLMutationResolver2.findByInput (Lcom/l7tech/external/assertions/gatewaygraphql/server/input/EntityInput;)Lcom/l7tech/objectmodel/Entity;
      // 7a: areturn
      // try (3 -> 8): 9 com/l7tech/objectmodel/FindException
      // try (6 -> 15): 15 com/l7tech/objectmodel/FindException
      // try (21 -> 28): 28 com/l7tech/objectmodel/FindException
      // try (31 -> 41): 41 com/l7tech/objectmodel/FindException
      // try (45 -> 51): 51 com/l7tech/objectmodel/FindException
   }

   private static FindException a(FindException var0) {
      return var0;
   }
}
