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

import com.fasterxml.jackson.annotation.JsonTypeName;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;

@JsonTypeName("user.validity")
public class UserValidityData {
   public static final String USER_VALIDITY_TYPE = "user.validity";
   @Schema(description = "Indicates whether the user is currently valid.")
   private boolean validNow;
   @Schema(description = "Indicates whether the user is enabled.")
   private boolean enabled;
   @Nullable
   @Schema(description = "The time period to which the user's validity is restricted - if not set, the user's validity is not restricted in time.")
   private UserValidityPeriodData period;

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

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

   @Nullable
   @SuppressFBWarnings(justification = "generated code")
   public UserValidityPeriodData getPeriod() {
      return this.period;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setValidNow(boolean validNow) {
      this.validNow = validNow;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setEnabled(boolean enabled) {
      this.enabled = enabled;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setPeriod(@Nullable UserValidityPeriodData period) {
      this.period = period;
   }

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

         if (this.validNow != other.validNow) {
            return false;
         }

         if (this.enabled != other.enabled) {
            return false;
         }

         Object this$period = this.period;
         Object other$period = other.period;
         return this$period == null ? other$period == null : this$period.equals(other$period);
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   protected boolean canEqual(Object other) {
      return other instanceof UserValidityData;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "UserValidityData(validNow=" + this.isValidNow() + ", enabled=" + this.isEnabled() + ", period=" + this.getPeriod() + ")";
   }
}
