package com.airlock.iam.apipolicyservice.domain.model;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.NonNull;

public final class ApiPolicyServicePlanUsage {
   @NonNull
   private final String name;
   private final Integer rateLimit;

   @SuppressFBWarnings(justification = "generated code")
   ApiPolicyServicePlanUsage(@NonNull String name, Integer rateLimit) {
      if (name == null) {
         throw new NullPointerException("name is marked non-null but is null");
      }

      this.name = name;
      this.rateLimit = rateLimit;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public Integer getRateLimit() {
      return this.rateLimit;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "ApiPolicyServicePlanUsage(name=" + this.getName() + ", rateLimit=" + this.getRateLimit() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class ApiPolicyServicePlanUsageBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String name;
      @SuppressFBWarnings(justification = "generated code")
      private Integer rateLimit;

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

      @SuppressFBWarnings(justification = "generated code")
      public ApiPolicyServicePlanUsage.ApiPolicyServicePlanUsageBuilder 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 ApiPolicyServicePlanUsage.ApiPolicyServicePlanUsageBuilder rateLimit(Integer rateLimit) {
         this.rateLimit = rateLimit;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public ApiPolicyServicePlanUsage build() {
         return new ApiPolicyServicePlanUsage(this.name, this.rateLimit);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "ApiPolicyServicePlanUsage.ApiPolicyServicePlanUsageBuilder(name=" + this.name + ", rateLimit=" + this.rateLimit + ")";
      }
   }
}
