package com.airlock.iam.flow.api.domain.model.flowcontrol;

import com.airlock.iam.flow.api.domain.model.step.StepId;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.NonNull;

public final class InteractiveGotoTarget {
   @NonNull
   private final StepId targetStepId;
   private final boolean treatedAsFailure;

   @SuppressFBWarnings(justification = "generated code")
   public InteractiveGotoTarget(@NonNull StepId targetStepId, boolean treatedAsFailure) {
      if (targetStepId == null) {
         throw new NullPointerException("targetStepId is marked non-null but is null");
      }

      this.targetStepId = targetStepId;
      this.treatedAsFailure = treatedAsFailure;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public StepId getTargetStepId() {
      return this.targetStepId;
   }

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

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

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "InteractiveGotoTarget(targetStepId=" + this.getTargetStepId() + ", treatedAsFailure=" + this.isTreatedAsFailure() + ")";
   }
}
