package com.airlock.iam.admin.domain.model.system;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.net.URI;
import java.util.Optional;
import lombok.NonNull;

public final class IamInstance {
   @NonNull
   private final String name;
   @NonNull
   private final Optional<String> tag;
   @NonNull
   private final String version;
   @NonNull
   private final URI docsUrl;
   @NonNull
   private final String skin;
   private final boolean skinFromParamAllowed;

   @SuppressFBWarnings(justification = "generated code")
   IamInstance(
      @NonNull String name, @NonNull Optional<String> tag, @NonNull String version, @NonNull URI docsUrl, @NonNull String skin, boolean skinFromParamAllowed
   ) {
      if (name == null) {
         throw new NullPointerException("name is marked non-null but is null");
      }

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

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

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

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

      this.name = name;
      this.tag = tag;
      this.version = version;
      this.docsUrl = docsUrl;
      this.skin = skin;
      this.skinFromParamAllowed = skinFromParamAllowed;
   }

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

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

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Optional<String> getTag() {
      return this.tag;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public String getVersion() {
      return this.version;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public URI getDocsUrl() {
      return this.docsUrl;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public String getSkin() {
      return this.skin;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isSkinFromParamAllowed() {
      return this.skinFromParamAllowed;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof IamInstance other)) {
         return false;
      } else {
         if (this.skinFromParamAllowed != other.skinFromParamAllowed) {
            return false;
         }

         Object this$name = this.name;
         Object other$name = other.name;
         if (this$name == null ? other$name == null : this$name.equals(other$name)) {
            Object this$tag = this.tag;
            Object other$tag = other.tag;
            if (this$tag == null ? other$tag == null : this$tag.equals(other$tag)) {
               Object this$version = this.version;
               Object other$version = other.version;
               if (this$version == null ? other$version == null : this$version.equals(other$version)) {
                  Object this$docsUrl = this.docsUrl;
                  Object other$docsUrl = other.docsUrl;
                  if (this$docsUrl == null ? other$docsUrl == null : this$docsUrl.equals(other$docsUrl)) {
                     Object this$skin = this.skin;
                     Object other$skin = other.skin;
                     return this$skin == null ? other$skin == null : this$skin.equals(other$skin);
                  } else {
                     return false;
                  }
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      result = result * 59 + (this.skinFromParamAllowed ? 79 : 97);
      Object $name = this.name;
      result = result * 59 + ($name == null ? 43 : $name.hashCode());
      Object $tag = this.tag;
      result = result * 59 + ($tag == null ? 43 : $tag.hashCode());
      Object $version = this.version;
      result = result * 59 + ($version == null ? 43 : $version.hashCode());
      Object $docsUrl = this.docsUrl;
      result = result * 59 + ($docsUrl == null ? 43 : $docsUrl.hashCode());
      Object $skin = this.skin;
      return result * 59 + ($skin == null ? 43 : $skin.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "IamInstance(name="
         + this.getName()
         + ", tag="
         + this.getTag()
         + ", version="
         + this.getVersion()
         + ", docsUrl="
         + this.getDocsUrl()
         + ", skin="
         + this.getSkin()
         + ", skinFromParamAllowed="
         + this.isSkinFromParamAllowed()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class IamInstanceBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String name;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<String> tag;
      @SuppressFBWarnings(justification = "generated code")
      private String version;
      @SuppressFBWarnings(justification = "generated code")
      private URI docsUrl;
      @SuppressFBWarnings(justification = "generated code")
      private String skin;
      @SuppressFBWarnings(justification = "generated code")
      private boolean skinFromParamAllowed;

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

      @SuppressFBWarnings(justification = "generated code")
      public IamInstance.IamInstanceBuilder 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 IamInstance.IamInstanceBuilder tag(@NonNull Optional<String> tag) {
         if (tag == null) {
            throw new NullPointerException("tag is marked non-null but is null");
         }

         this.tag = tag;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public IamInstance.IamInstanceBuilder version(@NonNull String version) {
         if (version == null) {
            throw new NullPointerException("version is marked non-null but is null");
         }

         this.version = version;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public IamInstance.IamInstanceBuilder docsUrl(@NonNull URI docsUrl) {
         if (docsUrl == null) {
            throw new NullPointerException("docsUrl is marked non-null but is null");
         }

         this.docsUrl = docsUrl;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public IamInstance.IamInstanceBuilder skin(@NonNull String skin) {
         if (skin == null) {
            throw new NullPointerException("skin is marked non-null but is null");
         }

         this.skin = skin;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public IamInstance.IamInstanceBuilder skinFromParamAllowed(boolean skinFromParamAllowed) {
         this.skinFromParamAllowed = skinFromParamAllowed;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public IamInstance build() {
         return new IamInstance(this.name, this.tag, this.version, this.docsUrl, this.skin, this.skinFromParamAllowed);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "IamInstance.IamInstanceBuilder(name="
            + this.name
            + ", tag="
            + this.tag
            + ", version="
            + this.version
            + ", docsUrl="
            + this.docsUrl
            + ", skin="
            + this.skin
            + ", skinFromParamAllowed="
            + this.skinFromParamAllowed
            + ")";
      }
   }
}
