package com.airlock.iam.authentication.infrastructure.transfer.request;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.Optional;

public final class PasswordChangeRequest {
   @Nullable
   @Schema(description = "The user's existing password. Depending on configuration, the old password is required.", maxLength = 100000)
   @Size(max = 100000)
   private String oldPassword;
   @NotNull
   @Schema(description = "The desired new password.", minLength = 1, maxLength = 100000)
   @Size(min = 1, max = 100000)
   private String newPassword;

   public Optional<String> getOldPassword() {
      return Optional.ofNullable(this.oldPassword);
   }

   @SuppressFBWarnings(justification = "generated code")
   public String getNewPassword() {
      return this.newPassword;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setOldPassword(@Nullable String oldPassword) {
      this.oldPassword = oldPassword;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setNewPassword(String newPassword) {
      this.newPassword = newPassword;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "PasswordChangeRequest(oldPassword=" + this.getOldPassword() + ", newPassword=" + this.getNewPassword() + ")";
   }
}
