package com.airlock.iam.flow.shared.domain.model.otp;

import com.airlock.iam.base.api.domain.model.mapification.MapifiedValues;
import com.airlock.iam.base.domain.model.mapification.MapifiedValuesBuilder;
import com.airlock.iam.common.domain.service.mapification.Mapifier;
import com.airlock.iam.core.misc.authen.AuthenticationSession;
import com.airlock.iam.flow.api.domain.model.step.StepSession;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public final class OtpCheckStepSession implements StepSession {
   private static final String AUTH_SESSION_KEY = "session";
   private final AuthenticationSession authenticationSession;

   @Override
   public MapifiedValues mapify() {
      return MapifiedValuesBuilder.mapifiedValues().put("session", Mapifier.getInstance().mapify(this.authenticationSession)).build();
   }

   public static OtpCheckStepSession demapify(MapifiedValues values) {
      return new OtpCheckStepSession(values.demapifyValue("session", Mapifier.getInstance()::demapify));
   }

   @SuppressFBWarnings(justification = "generated code")
   public OtpCheckStepSession(AuthenticationSession authenticationSession) {
      this.authenticationSession = authenticationSession;
   }

   @SuppressFBWarnings(justification = "generated code")
   public AuthenticationSession getAuthenticationSession() {
      return this.authenticationSession;
   }

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

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

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