package mapped;

import java.security.SecureRandom;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSEnumComposition;

@ObfuscatedName("hp")
public class EnumComposition extends DualNode implements RSEnumComposition {
   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "Lol;"
   )
   public static AbstractArchive EnumDefinition_archive;
   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable EnumDefinition_cached;
   @ObfuscatedName("aj")
   @ObfuscatedSignature(
      descriptor = "Ldz;"
   )
   static LoginScreenAnimation loginScreenRunesAnimation;
   @ObfuscatedName("ih")
   static SecureRandom field1896;
   @ObfuscatedName("ar")
   public char inputType;
   @ObfuscatedName("ao")
   public char outputType;
   @ObfuscatedName("ab")
   public String defaultStr;
   @ObfuscatedName("au")
   @ObfuscatedGetter(
      intValue = -1735445249
   )
   public int defaultInt;
   @ObfuscatedName("aa")
   @ObfuscatedGetter(
      intValue = -1590765713
   )
   public int outputCount;
   @ObfuscatedName("ac")
   public int[] keys;
   @ObfuscatedName("al")
   public int[] intVals;
   @ObfuscatedName("az")
   public String[] strVals;

   static {
      EnumDefinition_cached = new EvictingDualNodeHashTable(64);
   }

   EnumComposition() {
      this.defaultStr = "null";
      this.outputCount = 0;
   }

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(Luj;I)V",
      garbageValue = "-673581219"
   )
   void method3670(Buffer var1) {
      while(true) {
         int var2 = var1.readUnsignedByte_base();
         if(var2 == 0) {
            return;
         }

         this.method3669(var1, var2);
      }
   }

   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "(Luj;II)V",
      garbageValue = "225113863"
   )
   void method3669(Buffer var1, int var2) {
      if(var2 == 1) {
         this.inputType = (char)var1.readUnsignedByte_base();
      } else if(var2 == 2) {
         this.outputType = (char)var1.readUnsignedByte_base();
      } else if(var2 == 3) {
         this.defaultStr = var1.readStringCp1252NullTerminated_base();
      } else if(var2 == 4) {
         this.defaultInt = var1.readInt_base();
      } else {
         int var3;
         if(var2 == 5) {
            this.outputCount = var1.readUnsignedShort_base();
            this.keys = new int[this.outputCount];
            this.strVals = new String[this.outputCount];

            for(var3 = 0; var3 < this.outputCount; ++var3) {
               this.keys[var3] = var1.readInt_base();
               this.strVals[var3] = var1.readStringCp1252NullTerminated_base();
            }
         } else if(var2 == 6) {
            this.outputCount = var1.readUnsignedShort_base();
            this.keys = new int[this.outputCount];
            this.intVals = new int[this.outputCount];

            for(var3 = 0; var3 < this.outputCount; ++var3) {
               this.keys[var3] = var1.readInt_base();
               this.intVals[var3] = var1.readInt_base();
            }
         }
      }

   }

   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-1812244472"
   )
   public int size_base() {
      return this.outputCount;
   }

   public int[] getKeys() {
      return this.keys;
   }

   public String getDefaultString() {
      return this.defaultStr;
   }

   public int getDefaultInt() {
      return this.defaultInt;
   }

   public int[] getIntVals() {
      return this.intVals;
   }

   public String[] getStringVals() {
      return this.strVals;
   }

   public int getIntValue(int var1) {
      int[] var2 = this.getKeys();
      if(var2 == null) {
         return this.getDefaultInt();
      } else {
         for(int var3 = 0; var3 < var2.length; ++var3) {
            if(var2[var3] == var1) {
               int[] var4 = this.getIntVals();
               return var4[var3];
            }
         }

         return this.getDefaultInt();
      }
   }

   public String getStringValue(int var1) {
      int[] var2 = this.getKeys();
      if(var2 == null) {
         return this.getDefaultString();
      } else {
         for(int var3 = 0; var3 < var2.length; ++var3) {
            if(var2[var3] == var1) {
               String[] var4 = this.getStringVals();
               return var4[var3];
            }
         }

         return this.getDefaultString();
      }
   }

   public int size() {
      return this.size_base();
   }

   @ObfuscatedName("ap")
   @ObfuscatedSignature(
      descriptor = "(Lol;IB)Z",
      garbageValue = "120"
   )
   public static boolean method3679(AbstractArchive var0, int var1) {
      byte[] var2 = var0.takeFileFlat_base(var1);
      if(var2 == null) {
         return false;
      } else {
         class162.SpriteBuffer_decode_base(var2);
         return true;
      }
   }

   @ObfuscatedName("ap")
   @ObfuscatedSignature(
      descriptor = "(IIIII)V",
      garbageValue = "-264971545"
   )
   public static void method3678_base(int var0, int var1, int var2, int var3) {
      class316.musicPlayerStatus = var0;
      class316.field3418 = var1;
      class316.field3419 = var2;
      class316.field3417 = var3;
   }
}
