package mapped;

import net.runelite.api.Nameable;
import net.runelite.api.events.NameableNameChanged;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSUser;
import net.runelite.rs.api.RSUsername;

@ObfuscatedName("rf")
public class User implements Comparable<Nameable>, RSUser {
   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "Lvj;"
   )
   Username username;
   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "Lvj;"
   )
   Username previousUsername;

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(Lrf;B)I",
      garbageValue = "-95"
   )
   public int vmethod8263(User var1) {
      return this.username.method9958(var1.username);
   }

   @ObfuscatedName("be")
   @ObfuscatedSignature(
      descriptor = "(I)Lvj;",
      garbageValue = "-1855232108"
   )
   public Username method8171() {
      return this.username;
   }

   @ObfuscatedName("bd")
   @ObfuscatedSignature(
      descriptor = "(I)Ljava/lang/String;",
      garbageValue = "1231899353"
   )
   public String getName_base() {
      return this.username == null?"":this.username.getName_base();
   }

   @ObfuscatedName("bl")
   @ObfuscatedSignature(
      descriptor = "(I)Ljava/lang/String;",
      garbageValue = "52965911"
   )
   public String getPreviousName_base() {
      return this.previousUsername == null?"":this.previousUsername.getName_base();
   }

   @ObfuscatedName("bi")
   @ObfuscatedSignature(
      descriptor = "(Lvj;Lvj;B)V",
      garbageValue = "16"
   )
   void method8152(Username var1, Username var2) {
      if(var1 == null) {
         throw new NullPointerException();
      } else {
         this.username = var1;
         this.previousUsername = var2;
         this.onPrevNameChanged(-1);
      }
   }

   public RSUsername getRsName() {
      return this.username;
   }

   public RSUsername getRsPrevName() {
      return this.previousUsername;
   }

   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "-1"
   )
   public void onPrevNameChanged(int var1) {
      SpriteMask.client.getCallbacks().post(new NameableNameChanged(this));
   }

   public int compareTo(Nameable var1) {
      return this.vmethod8263((User)var1);
   }

   public String getName() {
      return this.getRsName().getName();
   }

   public String getPrevName() {
      RSUsername var1 = this.getRsPrevName();
      return var1 == null?null:var1.getName();
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(Lol;Lol;S)I",
      garbageValue = "-21186"
   )
   static int method8166(AbstractArchive var0, AbstractArchive var1) {
      int var2 = 0;
      String[] var3 = Login.field895;

      int var4;
      String var5;
      for(var4 = 0; var4 < var3.length; ++var4) {
         var5 = var3[var4];
         if(var0.tryLoadFileByNames_base(var5, "")) {
            ++var2;
         }
      }

      var3 = Login.field930;

      for(var4 = 0; var4 < var3.length; ++var4) {
         var5 = var3[var4];
         if(var1.tryLoadFileByNames_base(var5, "")) {
            ++var2;
         }
      }

      var3 = Login.field932;

      for(var4 = 0; var4 < var3.length; ++var4) {
         var5 = var3[var4];
         if(var1.getGroupId_base(var5) != -1 && var1.tryLoadFileByNames_base(var5, "")) {
            ++var2;
         }
      }

      return var2;
   }
}
