package com.airlock.iam.common.domain.model.claims;

import com.airlock.iam.common.api.domain.model.claims.ClaimValue;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public final class BooleanClaimValue implements ClaimValue {
   private final boolean value;

   public static BooleanClaimValue booleanClaimValue(boolean value) {
      return new BooleanClaimValue(value);
   }

   @Override
   public Object toJSONSerializable() {
      return this.value;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      return result * 59 + (this.value ? 79 : 97);
   }

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

   @SuppressFBWarnings(justification = "generated code")
   private BooleanClaimValue(boolean value) {
      this.value = value;
   }
}
