package com.airlock.iam.common.domain.model.auth.idpropagation;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.time.Duration;

public final class WafCredentialLifetime {
   private final Duration lifetime;

   public static WafCredentialLifetime lifetime(Duration lifetime) {
      return new WafCredentialLifetime(lifetime);
   }

   public String formatForWaf() {
      return ":" + this.lifetime.getSeconds();
   }

   @SuppressFBWarnings(justification = "generated code")
   public Duration getLifetime() {
      return this.lifetime;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "WafCredentialLifetime(lifetime=" + this.getLifetime() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   private WafCredentialLifetime(Duration lifetime) {
      this.lifetime = lifetime;
   }
}
