package com.l7tech.gateway.api;

import com.l7tech.gateway.api.impl.AccessorSupport;
import com.l7tech.gateway.api.impl.AttributeExtensibleType;
import com.l7tech.gateway.api.impl.ElementExtendableAccessibleObject;
import com.l7tech.gateway.api.impl.PropertiesMapType;
import com.l7tech.util.CollectionUtils;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Map;
import javax.xml.namespace.QName;
import org.jetbrains.annotations.NotNull;

@XmlRootElement(name = "SiteMinderConfiguration")
@XmlType(
   name = "SiteMinderConfigurationType",
   propOrder = {
         "nameValue",
         "addressValue",
         "hostnameValue",
         "hostConfigurationValue",
         "userNameValue",
         "passwordIdValue",
         "enabledValue",
         "fipsModeValue",
         "ipCheckValue",
         "updateSsoTokenValue",
         "clusterThresholdValue",
         "nonClusterFailoverValue",
         "secretValue",
         "properties",
         "extension",
         "extensions"
   }
)
@AccessorSupport.AccessibleResource(name = "siteMinderConfigurations")
public class SiteMinderConfigurationMO extends ElementExtendableAccessibleObject {
   private AttributeExtensibleType.AttributeExtensibleString h;
   private AttributeExtensibleType.AttributeExtensibleString i;
   private AttributeExtensibleType.AttributeExtensibleString j;
   private AttributeExtensibleType.AttributeExtensibleString k;
   private AttributeExtensibleType.AttributeExtensibleString l;
   private AttributeExtensibleType.AttributeExtensibleString m;
   private AttributeExtensibleType.AttributeExtensibleString n;
   private AttributeExtensibleType.AttributeExtensibleBoolean o;
   private AttributeExtensibleType.AttributeExtensibleBoolean p;
   private AttributeExtensibleType.AttributeExtensibleBoolean q;
   private AttributeExtensibleType.AttributeExtensibleBoolean r;
   private AttributeExtensibleType.AttributeExtensibleInteger s;
   private AttributeExtensibleType.AttributeExtensibleInteger t;
   private Map<String, String> u;
   private static final String[] v;

   public String getName() {
      return AttributeExtensibleType.get(this.h);
   }

   public void setName(String var1) {
      this.h = AttributeExtensibleType.set(this.h, var1);
   }

   public String getAddress() {
      return AttributeExtensibleType.get(this.i);
   }

   public void setAddress(String var1) {
      this.i = AttributeExtensibleType.set(this.i, var1);
   }

   public String getSecret() {
      return AttributeExtensibleType.get(this.j);
   }

   public void setSecret(String var1) {
      this.j = AttributeExtensibleType.set(this.j, var1);
   }

   public void setEncryptedSecret(@NotNull String var1, @NotNull String var2) {
      try {
         if (var1 == null) {
            b(0);
         }
      } catch (IllegalArgumentException var3) {
         throw var3;
      }

      try {
         if (var2 == null) {
            b(1);
         }
      } catch (IllegalArgumentException var4) {
         throw var4;
      }

      this.j = new AttributeExtensibleType.AttributeExtensibleString();
      this.j.setValue(var1);
      this.j.setAttributeExtensions(CollectionUtils.mapBuilder().put(new QName(v[5]), var2).map());
   }

   public String getSecretBundleKey() {
      // $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 0
      // 01: getfield com/l7tech/gateway/api/SiteMinderConfigurationMO.j Lcom/l7tech/gateway/api/impl/AttributeExtensibleType$AttributeExtensibleString;
      // 04: ifnull 32
      // 07: aload 0
      // 08: getfield com/l7tech/gateway/api/SiteMinderConfigurationMO.j Lcom/l7tech/gateway/api/impl/AttributeExtensibleType$AttributeExtensibleString;
      // 0b: invokevirtual com/l7tech/gateway/api/impl/AttributeExtensibleType$AttributeExtensibleString.getAttributeExtensions ()Ljava/util/Map;
      // 0e: ifnull 32
      // 11: goto 15
      // 14: athrow
      // 15: aload 0
      // 16: getfield com/l7tech/gateway/api/SiteMinderConfigurationMO.j Lcom/l7tech/gateway/api/impl/AttributeExtensibleType$AttributeExtensibleString;
      // 19: invokevirtual com/l7tech/gateway/api/impl/AttributeExtensibleType$AttributeExtensibleString.getAttributeExtensions ()Ljava/util/Map;
      // 1c: new javax/xml/namespace/QName
      // 1f: dup
      // 20: getstatic com/l7tech/gateway/api/SiteMinderConfigurationMO.v [Ljava/lang/String;
      // 23: bipush 0
      // 24: aaload
      // 25: invokespecial javax/xml/namespace/QName.<init> (Ljava/lang/String;)V
      // 28: invokeinterface java/util/Map.get (Ljava/lang/Object;)Ljava/lang/Object; 2
      // 2d: checkcast java/lang/String
      // 30: areturn
      // 31: athrow
      // 32: aconst_null
      // 33: areturn
      // try (0 -> 7): 8 java/lang/IllegalArgumentException
      // try (3 -> 21): 21 java/lang/IllegalArgumentException
   }

   public String getHostname() {
      return AttributeExtensibleType.get(this.k);
   }

   public void setHostname(String var1) {
      this.k = AttributeExtensibleType.set(this.k, var1);
   }

   public String getHostConfiguration() {
      return AttributeExtensibleType.get(this.l);
   }

   public void setHostConfiguration(String var1) {
      this.l = AttributeExtensibleType.set(this.l, var1);
   }

   public String getUserName() {
      return AttributeExtensibleType.get(this.m);
   }

   public void setUserName(String var1) {
      this.m = AttributeExtensibleType.set(this.m, var1);
   }

   public String getPasswordId() {
      return AttributeExtensibleType.get(this.n);
   }

   public void setPasswordId(String var1) {
      this.n = AttributeExtensibleType.set(this.n, var1);
   }

   public boolean getIpCheck() {
      return AttributeExtensibleType.get(this.o, false);
   }

   public void setIpCheck(boolean var1) {
      this.o = AttributeExtensibleType.set(this.o, var1);
   }

   public boolean getUpdateSsoToken() {
      return AttributeExtensibleType.get(this.p, false);
   }

   public void setUpdateSsoToken(boolean var1) {
      this.p = AttributeExtensibleType.set(this.p, var1);
   }

   public boolean getEnabled() {
      return AttributeExtensibleType.get(this.q, false);
   }

   public void setEnabled(boolean var1) {
      this.q = AttributeExtensibleType.set(this.q, var1);
   }

   public boolean getNonClusterFailover() {
      return AttributeExtensibleType.get(this.r, false);
   }

   public void setNonClusterFailover(boolean var1) {
      this.r = AttributeExtensibleType.set(this.r, var1);
   }

   public int getFipsMode() {
      return AttributeExtensibleType.get(this.s, 0);
   }

   public void setFipsMode(int var1) {
      this.s = AttributeExtensibleType.set(this.s, var1);
   }

   public int getClusterThreshold() {
      return AttributeExtensibleType.get(this.t, 50);
   }

   public void setClusterThreshold(int var1) {
      this.t = AttributeExtensibleType.set(this.t, var1);
   }

   @XmlElement(name = "Properties")
   @XmlJavaTypeAdapter(PropertiesMapType.PropertiesMapTypeAdapter.class)
   public Map<String, String> getProperties() {
      return this.u;
   }

   public void setProperties(Map<String, String> var1) {
      this.u = var1;
   }

   @XmlElement(name = "Name", required = true)
   protected AttributeExtensibleType.AttributeExtensibleString getNameValue() {
      return this.h;
   }

   protected void setNameValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.h = var1;
   }

   @XmlElement(name = "Address", required = true)
   protected AttributeExtensibleType.AttributeExtensibleString getAddressValue() {
      return this.i;
   }

   protected void setAddressValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.i = var1;
   }

   @XmlElement(name = "Secret")
   protected AttributeExtensibleType.AttributeExtensibleString getSecretValue() {
      return this.j;
   }

   protected void setSecretValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.j = var1;
   }

   @XmlElement(name = "Hostname", required = true)
   protected AttributeExtensibleType.AttributeExtensibleString getHostnameValue() {
      return this.k;
   }

   protected void setHostnameValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.k = var1;
   }

   @XmlElement(name = "HostConfiguration")
   protected AttributeExtensibleType.AttributeExtensibleString getHostConfigurationValue() {
      return this.l;
   }

   protected void setHostConfigurationValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.l = var1;
   }

   @XmlElement(name = "UserName")
   protected AttributeExtensibleType.AttributeExtensibleString getUserNameValue() {
      return this.m;
   }

   protected void setUserNameValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.m = var1;
   }

   @XmlElement(name = "PasswordId")
   protected AttributeExtensibleType.AttributeExtensibleString getPasswordIdValue() {
      return this.n;
   }

   protected void setPasswordIdValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.n = var1;
   }

   @XmlElement(name = "IpCheck", required = true)
   protected AttributeExtensibleType.AttributeExtensibleBoolean getIpCheckValue() {
      return this.o;
   }

   protected void setIpCheckValue(AttributeExtensibleType.AttributeExtensibleBoolean var1) {
      this.o = var1;
   }

   @XmlElement(name = "UpdateSsoToken", required = true)
   protected AttributeExtensibleType.AttributeExtensibleBoolean getUpdateSsoTokenValue() {
      return this.p;
   }

   protected void setUpdateSsoTokenValue(AttributeExtensibleType.AttributeExtensibleBoolean var1) {
      this.p = var1;
   }

   @XmlElement(name = "Enabled", required = true)
   protected AttributeExtensibleType.AttributeExtensibleBoolean getEnabledValue() {
      return this.q;
   }

   protected void setEnabledValue(AttributeExtensibleType.AttributeExtensibleBoolean var1) {
      this.q = var1;
   }

   @XmlElement(name = "NonClusterFailover", required = true)
   protected AttributeExtensibleType.AttributeExtensibleBoolean getNonClusterFailoverValue() {
      return this.r;
   }

   protected void setNonClusterFailoverValue(AttributeExtensibleType.AttributeExtensibleBoolean var1) {
      this.r = var1;
   }

   @XmlElement(name = "FipsMode")
   protected AttributeExtensibleType.AttributeExtensibleInteger getFipsModeValue() {
      return this.s;
   }

   protected void setFipsModeValue(AttributeExtensibleType.AttributeExtensibleInteger var1) {
      this.s = var1;
   }

   @XmlElement(name = "ClusterThreshold")
   protected AttributeExtensibleType.AttributeExtensibleInteger getClusterThresholdValue() {
      return this.t;
   }

   protected void setClusterThresholdValue(AttributeExtensibleType.AttributeExtensibleInteger var1) {
      this.t = var1;
   }

   SiteMinderConfigurationMO() {
   }

   static {
      String[] var5 = new String[6];
      int var3 = 0;
      String var2 = "\u001d}v#!Wu\u001aq0\u001cguh!\u0005J\u001akph*SJ\u001a\u007fy>bSN\u0016'K.9Ws\u0016f|\"?qQ\u0011nq 8@_\u000baw)\u0000}\u000f\u001af{54BJ\u001alK\".@[\u000b>>z\u007f2 WP\u000b(~(?\u0012~1gl\t8^R_xy5,_[\u000bmjgj\u0017MX(w!m\u0017MQ-kg GM\u000b(v(9\u0012\\\u001a(v2!^";
      int var4 = "\u001d}v#!Wu\u001aq0\u001cguh!\u0005J\u001akph*SJ\u001a\u007fy>bSN\u0016'K.9Ws\u0016f|\"?qQ\u0011nq 8@_\u000baw)\u0000}\u000f\u001af{54BJ\u001alK\".@[\u000b>>z\u007f2 WP\u000b(~(?\u0012~1gl\t8^R_xy5,_[\u000bmjgj\u0017MX(w!m\u0017MQ-kg GM\u000b(v(9\u0012\\\u001a(v2!^"
         .length();
      char var1 = '\t';
      int var7 = -1;

      label24:
      while (true) {
         String var10000 = var2.substring(++var7, var7 + var1);
         byte var10001 = -1;

         while (true) {
            String var12 = b(b(var10000));
            switch (var10001) {
               case 0:
                  var5[var3++] = var12;
                  if ((var7 += var1) >= var4) {
                     v = var5;
                     return;
                  }

                  var1 = var2.charAt(var7);
                  break;
               default:
                  var5[var3++] = var12;
                  if ((var7 += var1) < var4) {
                     var1 = var2.charAt(var7);
                     continue label24;
                  }

                  var2 = "\fml\u0002#QL\u0006xl\")a[\u001cz}3\t\u001d}v#!Wu\u001aq";
                  var4 = "\fml\u0002#QL\u0006xl\")a[\u001cz}3\t\u001d}v#!Wu\u001aq".length();
                  var1 = 18;
                  var7 = -1;
            }

            var10000 = var2.substring(++var7, var7 + var1);
            var10001 = 0;
         }
      }
   }

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

      return var10000;
   }

   private static String b(char[] var0) {
      int var10002 = var0.length;
      char[] var10001 = var0;
      int var10000 = var10002;

      for (int var1 = 0; var10000 > var1; var1++) {
         var10001[var1] = (char)(var10001[var1] ^ switch (var1 % 7) {
            case 0 -> 127;
            case 1 -> 8;
            case 2 -> 24;
            case 3 -> 71;
            case 4 -> 77;
            case 5 -> 50;
            default -> 62;
         });
      }

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