package com.airlock.iam.admin.infrastructure.transfer.response;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.annotation.Nonnull;
import java.util.List;

public final class AdminData {
   @Nonnull
   private final String name;
   @Nonnull
   private final String providedName;
   private final List<String> roles;
   private final String realm;

   @SuppressFBWarnings(justification = "generated code")
   AdminData(@Nonnull String name, @Nonnull String providedName, List<String> roles, String realm) {
      if (name == null) {
         throw new NullPointerException("name is marked non-null but is null");
      }

      if (providedName == null) {
         throw new NullPointerException("providedName is marked non-null but is null");
      }

      this.name = name;
      this.providedName = providedName;
      this.roles = roles;
      this.realm = realm;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static AdminData.AdminDataBuilder builder() {
      return new AdminData.AdminDataBuilder();
   }

   @Nonnull
   @SuppressFBWarnings(justification = "generated code")
   public String getName() {
      return this.name;
   }

   @Nonnull
   @SuppressFBWarnings(justification = "generated code")
   public String getProvidedName() {
      return this.providedName;
   }

   @SuppressFBWarnings(justification = "generated code")
   public List<String> getRoles() {
      return this.roles;
   }

   @SuppressFBWarnings(justification = "generated code")
   public String getRealm() {
      return this.realm;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof AdminData other)) {
         return false;
      } else {
         Object this$name = this.name;
         Object other$name = other.name;
         if (this$name == null ? other$name == null : this$name.equals(other$name)) {
            Object this$providedName = this.providedName;
            Object other$providedName = other.providedName;
            if (this$providedName == null ? other$providedName == null : this$providedName.equals(other$providedName)) {
               Object this$roles = this.roles;
               Object other$roles = other.roles;
               if (this$roles == null ? other$roles == null : this$roles.equals(other$roles)) {
                  Object this$realm = this.realm;
                  Object other$realm = other.realm;
                  return this$realm == null ? other$realm == null : this$realm.equals(other$realm);
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      Object $name = this.name;
      result = result * 59 + ($name == null ? 43 : $name.hashCode());
      Object $providedName = this.providedName;
      result = result * 59 + ($providedName == null ? 43 : $providedName.hashCode());
      Object $roles = this.roles;
      result = result * 59 + ($roles == null ? 43 : $roles.hashCode());
      Object $realm = this.realm;
      return result * 59 + ($realm == null ? 43 : $realm.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "AdminData(name="
         + this.getName()
         + ", providedName="
         + this.getProvidedName()
         + ", roles="
         + this.getRoles()
         + ", realm="
         + this.getRealm()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class AdminDataBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String name;
      @SuppressFBWarnings(justification = "generated code")
      private String providedName;
      @SuppressFBWarnings(justification = "generated code")
      private List<String> roles;
      @SuppressFBWarnings(justification = "generated code")
      private String realm;

      @SuppressFBWarnings(justification = "generated code")
      AdminDataBuilder() {
      }

      @SuppressFBWarnings(justification = "generated code")
      public AdminData.AdminDataBuilder name(@Nonnull String name) {
         if (name == null) {
            throw new NullPointerException("name is marked non-null but is null");
         }

         this.name = name;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public AdminData.AdminDataBuilder providedName(@Nonnull String providedName) {
         if (providedName == null) {
            throw new NullPointerException("providedName is marked non-null but is null");
         }

         this.providedName = providedName;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public AdminData.AdminDataBuilder roles(List<String> roles) {
         this.roles = roles;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public AdminData.AdminDataBuilder realm(String realm) {
         this.realm = realm;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public AdminData build() {
         return new AdminData(this.name, this.providedName, this.roles, this.realm);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "AdminData.AdminDataBuilder(name="
            + this.name
            + ", providedName="
            + this.providedName
            + ", roles="
            + this.roles
            + ", realm="
            + this.realm
            + ")";
      }
   }
}
