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

import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
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;
import java.util.LinkedHashMap;
import java.util.Map;

@JsonTypeName("user.creation")
@JsonPropertyOrder("password")
@Schema(ref = "#/components/schemas/UserCreateRequestOverride")
public class UserCreateRequest {
   public static final String USER_CREATION_TYPE = "user.creation";
   @Nullable
   private String password;
   @Nullable
   private Map<String, Object> contextData;

   @JsonAnySetter
   public void setContextData(String key, Object value) {
      if (this.contextData == null) {
         this.contextData = new LinkedHashMap<>();
      }

      this.contextData.put(key, value);
   }

   @Nullable
   @SuppressFBWarnings(justification = "generated code")
   public String getPassword() {
      return this.password;
   }

   @Nullable
   @SuppressFBWarnings(justification = "generated code")
   public Map<String, Object> getContextData() {
      return this.contextData;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public void setContextData(@Nullable Map<String, Object> contextData) {
      this.contextData = contextData;
   }

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

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "UserCreateRequest(password=" + this.getPassword() + ", contextData=" + this.getContextData() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public UserCreateRequest() {
   }

   @SuppressFBWarnings(justification = "generated code")
   public UserCreateRequest(@Nullable String password, @Nullable Map<String, Object> contextData) {
      this.password = password;
      this.contextData = contextData;
   }
}
