package com.l7tech.gateway.api;

import com.l7tech.gateway.api.impl.ElementExtensionSupport;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlEnum;
import jakarta.xml.bind.annotation.XmlEnumValue;
import jakarta.xml.bind.annotation.XmlType;

@XmlType(name = "PolicyReferenceInstructionType", propOrder = {"extension", "extensions"})
public class PolicyReferenceInstruction extends ElementExtensionSupport {
   private PolicyReferenceInstruction.PolicyReferenceInstructionType d;
   private String e;
   private String f;
   private String g;
   private String h;

   @XmlAttribute(name = "type", required = true)
   public PolicyReferenceInstruction.PolicyReferenceInstructionType getPolicyReferenceInstructionType() {
      return this.d;
   }

   public void setPolicyReferenceInstructionType(PolicyReferenceInstruction.PolicyReferenceInstructionType var1) {
      this.d = var1;
   }

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

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

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

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

   @XmlAttribute(name = "mappedReferenceId")
   public String getMappedReferenceId() {
      return this.g;
   }

   public void setMappedReferenceId(String var1) {
      this.g = var1;
   }

   @XmlAttribute(name = "mappedName")
   public String getMappedName() {
      return this.h;
   }

   public void setMappedName(String var1) {
      this.h = var1;
   }

   PolicyReferenceInstruction() {
   }

   @XmlEnum(String.class)
   @XmlType(name = "PolicyReferenceInstructionTypeType")
   public enum PolicyReferenceInstructionType {
      @XmlEnumValue("Delete")
      DELETE,
      @XmlEnumValue("Ignore")
      IGNORE,
      @XmlEnumValue("Map")
      MAP,
      @XmlEnumValue("Rename")
      RENAME;

      // $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[4];
         int var4 = 0;
         String var3 = "K[R.hd\u0003T_L";
         int var5 = "K[R.hd\u0003T_L".length();
         char var2 = 6;
         int var7 = -1;

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

            while (true) {
               String var12 = a(a(var10000));
               switch (var10001) {
                  case 0:
                     var0[var4++] = var12;
                     if ((var7 += var2) >= var5) {
                        DELETE = new PolicyReferenceInstruction.PolicyReferenceInstructionType();
                        IGNORE = new PolicyReferenceInstruction.PolicyReferenceInstructionType();
                        MAP = new PolicyReferenceInstruction.PolicyReferenceInstructionType();
                        RENAME = new PolicyReferenceInstruction.PolicyReferenceInstructionType();
                        return;
                     }

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

                     var3 = "PYR wd\u0006][P*qd";
                     var5 = "PYR wd\u0006][P*qd".length();
                     var2 = 6;
                     var7 = -1;
               }

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

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

         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 -> 25;
               case 1 -> 30;
               case 2 -> 28;
               case 3 -> 111;
               case 4 -> 37;
               case 5 -> 33;
               default -> 112;
            });
         }

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