package com.l7tech.gateway.common.admin;

import com.l7tech.gateway.common.security.rbac.MethodStereotype;
import com.l7tech.gateway.common.security.rbac.Secured;
import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.gateway.common.service.ServiceHeader;
import com.l7tech.gateway.common.uddi.UDDIProxiedServiceInfo;
import com.l7tech.gateway.common.uddi.UDDIPublishStatus;
import com.l7tech.gateway.common.uddi.UDDIRegistry;
import com.l7tech.gateway.common.uddi.UDDIServiceControl;
import com.l7tech.objectmodel.DeleteException;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.objectmodel.SecurityZone;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.objectmodel.VersionException;
import com.l7tech.uddi.UDDIException;
import java.util.Collection;
import java.util.Map;
import org.jetbrains.annotations.Nullable;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
@Secured(types = EntityType.UDDI_REGISTRY)
@Administrative
public interface UDDIRegistryAdmin {
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.SAVE_OR_UPDATE)
   Goid saveUDDIRegistry(UDDIRegistry var1) throws SaveException, UpdateException, FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.FIND_ENTITIES)
   Collection<UDDIRegistry> findAllUDDIRegistries() throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.FIND_ENTITY)
   UDDIRegistry findByPrimaryKey(Goid var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.GET_PROPERTY_BY_ID)
   boolean subscriptionNotificationsAvailable(Goid var1);

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.GET_PROPERTY_BY_ID)
   boolean metricsAvailable(Goid var1) throws FindException;

   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.DELETE_BY_ID)
   void deleteUDDIRegistry(Goid var1) throws DeleteException, FindException, UDDIException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.TEST_CONFIGURATION)
   void testUDDIRegistryAuthentication(UDDIRegistry var1) throws UDDIException;

   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.SAVE_OR_UPDATE, relevantArg = 0)
   void publishGatewayWsdl(PublishedService var1, Goid var2, String var3, String var4, boolean var5, @Nullable SecurityZone var6) throws FindException, UDDIRegistryAdmin.PublishProxiedServiceException, VersionException, UpdateException, SaveException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException;

   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.SAVE_OR_UPDATE, relevantArg = 0)
   void overwriteBusinessServiceInUDDI(PublishedService var1, boolean var2, @Nullable SecurityZone var3) throws SaveException, FindException;

   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.SAVE_OR_UPDATE, relevantArg = 0)
   void publishGatewayEndpoint(PublishedService var1, boolean var2, Map<String, Object> var3, @Nullable SecurityZone var4) throws FindException, SaveException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException;

   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.SAVE_OR_UPDATE, relevantArg = 0)
   void publishGatewayEndpointGif(PublishedService var1, Map<String, Object> var2, @Nullable SecurityZone var3) throws FindException, SaveException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException;

   @Secured(types = EntityType.UDDI_PROXIED_SERVICE_INFO, stereotype = MethodStereotype.SAVE_OR_UPDATE)
   void updatePublishedGatewayWsdl(Goid var1) throws FindException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException, UDDIRegistryAdmin.PublishProxiedServiceException, UpdateException, VersionException;

   @Secured(types = EntityType.UDDI_PROXIED_SERVICE_INFO, stereotype = MethodStereotype.DELETE_ENTITY)
   void deleteGatewayWsdlFromUDDI(UDDIProxiedServiceInfo var1) throws FindException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException, UpdateException, DeleteException;

   @Secured(types = EntityType.UDDI_PROXIED_SERVICE_INFO, stereotype = MethodStereotype.DELETE_ENTITY)
   void deleteGatewayEndpointFromUDDI(UDDIProxiedServiceInfo var1) throws FindException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException, UpdateException, DeleteException;

   @Secured(types = EntityType.UDDI_PROXIED_SERVICE_INFO, stereotype = MethodStereotype.SAVE_OR_UPDATE)
   void updateProxiedServiceOnly(UDDIProxiedServiceInfo var1) throws UpdateException, FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.FIND_ENTITY)
   UDDIProxiedServiceInfo findProxiedServiceInfoForPublishedService(Goid var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.GET_PROPERTY_BY_ID, relevantArg = 1)
   UDDIPublishStatus getPublishStatusForProxy(Goid var1, Goid var2) throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.FIND_ENTITIES)
   Collection<UDDIProxiedServiceInfo> getAllProxiedServicesForRegistry(Goid var1) throws FindException;

   @Secured(types = EntityType.UDDI_SERVICE_CONTROL, stereotype = MethodStereotype.SAVE_OR_UPDATE, relevantArg = 0)
   Goid saveUDDIServiceControlOnly(UDDIServiceControl var1, String var2, Long var3) throws UpdateException, SaveException, FindException, UDDIRegistryAdmin.UDDIRegistryNotEnabledException;

   @Secured(types = EntityType.UDDI_SERVICE_CONTROL, stereotype = MethodStereotype.DELETE_BY_ID)
   void deleteUDDIServiceControl(Goid var1) throws FindException, DeleteException, UpdateException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.FIND_ENTITY)
   UDDIServiceControl getUDDIServiceControl(Goid var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_SERVICE_CONTROL, stereotype = MethodStereotype.GET_PROPERTY_BY_ID)
   String getOriginalServiceEndPoint(Goid var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.UDDI_REGISTRY, stereotype = MethodStereotype.FIND_ENTITIES)
   Collection<UDDIServiceControl> getAllServiceControlsForRegistry(Goid var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.SERVICE, stereotype = MethodStereotype.FIND_ENTITIES)
   Collection<ServiceHeader> getServicesPublishedToUDDI(Collection<Goid> var1) throws FindException;

   enum EndpointScheme {
      HTTP,
      HTTPS;

      // $VF: Failed to inline enum fields
      // 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!)
      static {
         String[] var0 = new String[2];
         int var4 = 0;
         String var3 = "(1IU\u0005(1IU\u0016";
         int var5 = "(1IU\u0005(1IU\u0016".length();
         char var2 = 4;
         int var1 = -1;

         while (true) {
            String var10002 = a(25, a(var3.substring(++var1, var1 + var2)));
            byte var10001 = -1;
            var0[var4++] = var10002;
            if ((var1 += var2) >= var5) {
               HTTP = new UDDIRegistryAdmin.EndpointScheme();
               HTTPS = new UDDIRegistryAdmin.EndpointScheme();
               return;
            }

            var2 = var3.charAt(var1);
         }
      }

      private static char[] a(String var0) {
         char[] var10000 = var0.toCharArray();
         if (var10000.length < 2) {
            var10000[0] = (char)(var10000[0] ^ 29);
         }

         return var10000;
      }

      private static String a(int var0, char[] var1) {
         int var10003 = var1.length;
         int var10002 = var0;
         char[] var10001 = var1;
         int var10000 = var10003;

         for (int var2 = 0; var10000 > var2; var2++) {
            var10001[var2] = (char)(var10001[var2] ^ var10002 ^ switch (var2 % 7) {
               case 0 -> 121;
               case 1 -> 124;
               case 2 -> 4;
               case 3 -> 28;
               case 4 -> 92;
               case 5 -> 15;
               default -> 29;
            });
         }

         return new String(var10001).intern();
      }
   }

   class PublishProxiedServiceException extends Exception {
      static final long serialVersionUID = -5055640733977565086L;

      public PublishProxiedServiceException(String var1) {
         super(var1);
      }
   }

   class UDDIRegistryNotEnabledException extends Exception {
      static final long serialVersionUID = -7818742417772936516L;

      public UDDIRegistryNotEnabledException(String var1) {
         super(var1);
      }
   }
}
