package com.l7tech.gateway.api;

import com.l7tech.gateway.api.impl.AttributeExtensibleType;
import com.l7tech.gateway.api.impl.ElementExtendableManagedObject;
import com.l7tech.gateway.api.impl.PolicyImportContext;
import com.l7tech.util.Functions;
import jakarta.xml.bind.annotation.XmlAnyAttribute;
import jakarta.xml.bind.annotation.XmlAnyElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlEnum;
import jakarta.xml.bind.annotation.XmlEnumValue;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.bind.annotation.XmlType;
import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;

@XmlRootElement(name = "PolicyImportResult")
@XmlType(name = "PolicyImportResultType", propOrder = {"warningsValue", "importedPolicyReferences", "extension", "extensions"})
@XmlSeeAlso(PolicyImportContext.class)
public class PolicyImportResult extends ElementExtendableManagedObject {
   private List<AttributeExtensibleType.AttributeExtensibleString> f;
   private List<PolicyImportResult.ImportedPolicyReference> g;

   public List<String> getWarnings() {
      return this.f == null ? null : Functions.map(this.f, new j(this));
   }

   public void setWarnings(List<String> var1) {
      this.f = var1 == null ? null : Functions.map(var1, new k(this));
   }

   @XmlElementWrapper(name = "ImportedPolicyReferences")
   @XmlElement(name = "ImportedPolicyReference", required = true)
   public List<PolicyImportResult.ImportedPolicyReference> getImportedPolicyReferences() {
      return this.g;
   }

   public void setImportedPolicyReferences(List<PolicyImportResult.ImportedPolicyReference> var1) {
      this.g = var1;
   }

   @XmlElementWrapper(name = "Warnings")
   @XmlElement(name = "Warning", required = true)
   protected List<AttributeExtensibleType.AttributeExtensibleString> getWarningsValue() {
      return this.f;
   }

   protected void setWarningsValue(List<AttributeExtensibleType.AttributeExtensibleString> var1) {
      this.f = var1;
   }

   PolicyImportResult() {
   }

   @XmlType(name = "ImportedPolicyReferenceType")
   public static class ImportedPolicyReference {
      private PolicyImportResult.ImportedPolicyReferenceType a;
      private String b;
      private String c;
      private String d;
      private String e;
      private List<Object> f;
      private Map<QName, Object> g;

      ImportedPolicyReference() {
      }

      @XmlAttribute(name = "type", required = true)
      public PolicyImportResult.ImportedPolicyReferenceType getType() {
         return this.a;
      }

      public void setType(PolicyImportResult.ImportedPolicyReferenceType var1) {
         this.a = var1;
      }

      @XmlAttribute(name = "referenceType", required = true)
      public String getReferenceType() {
         return this.b;
      }

      public void setReferenceType(String var1) {
         this.b = var1;
      }

      @XmlAttribute(name = "referenceId", required = true)
      public String getReferenceId() {
         return this.c;
      }

      public void setReferenceId(String var1) {
         this.c = var1;
      }

      @XmlAttribute(name = "id", required = true)
      public String getId() {
         return this.d;
      }

      public void setId(String var1) {
         this.d = var1;
      }

      @XmlAttribute(name = "guid")
      public String getGuid() {
         return this.e;
      }

      public void setGuid(String var1) {
         this.e = var1;
      }

      @XmlAnyAttribute
      protected Map<QName, Object> getAttributeExtensions() {
         return this.g;
      }

      protected void setAttributeExtensions(Map<QName, Object> var1) {
         this.g = var1;
      }

      @XmlAnyElement(lax = true)
      protected List<Object> getExtensions() {
         return this.f;
      }

      protected void setExtensions(List<Object> var1) {
         this.f = var1;
      }
   }

   @XmlEnum(String.class)
   @XmlType(name = "ImportedPolicyReferenceTypeType")
   public enum ImportedPolicyReferenceType {
      @XmlEnumValue("Created")
      CREATED,
      @XmlEnumValue("Mapped")
      MAPPED;

      // $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 = "\u0018<b$!ng\u0006\u0016/w50o";
         int var5 = "\u0018<b$!ng\u0006\u0016/w50o".length();
         char var2 = 7;
         int var1 = -1;

         while (true) {
            String var10002 = a(a(var3.substring(++var1, var1 + var2)));
            byte var10001 = -1;
            var0[var4++] = var10002;
            if ((var1 += var2) >= var5) {
               CREATED = new PolicyImportResult.ImportedPolicyReferenceType();
               MAPPED = new PolicyImportResult.ImportedPolicyReferenceType();
               return;
            }

            var2 = var3.charAt(var1);
         }
      }

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

         return var10000;
      }

      private static String a(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 -> 91;
               case 1 -> 110;
               case 2 -> 39;
               case 3 -> 101;
               case 4 -> 117;
               case 5 -> 43;
               default -> 35;
            });
         }

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