/*
 * appNG REST API
 * The REST API for appNG
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: matthias.mueller@appng.org
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.appng.openapi.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 * A validation rule that can be bound to an action-field.
 */
@ApiModel(description = "A validation rule that can be bound to an action-field.")
@JsonPropertyOrder({
  ValidationRule.JSON_PROPERTY_TYPE,
  ValidationRule.JSON_PROPERTY_MESSAGE,
  ValidationRule.JSON_PROPERTY_ACTIVE,
  ValidationRule.JSON_PROPERTY_MESSAGE_KEY,
  ValidationRule.JSON_PROPERTY_OPTIONS
})
@JsonTypeName("ValidationRule")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-09-06T11:11:26.226947+02:00[Europe/Berlin]")
public class ValidationRule {
  public static final String JSON_PROPERTY_TYPE = "type";
  private String type;

  public static final String JSON_PROPERTY_MESSAGE = "message";
  private String message;

  public static final String JSON_PROPERTY_ACTIVE = "active";
  private Boolean active;

  public static final String JSON_PROPERTY_MESSAGE_KEY = "messageKey";
  private String messageKey;

  public static final String JSON_PROPERTY_OPTIONS = "options";
  private Map<String, String> options = null;


  public ValidationRule type(String type) {
    
    this.type = type;
    return this;
  }

   /**
   * The type of the rule.
   * @return type
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The type of the rule.")
  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getType() {
    return type;
  }


  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setType(String type) {
    this.type = type;
  }


  public ValidationRule message(String message) {
    
    this.message = message;
    return this;
  }

   /**
   * The error message displayed when the rule isn&#39;t fulfilled.
   * @return message
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The error message displayed when the rule isn't fulfilled.")
  @JsonProperty(JSON_PROPERTY_MESSAGE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getMessage() {
    return message;
  }


  @JsonProperty(JSON_PROPERTY_MESSAGE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMessage(String message) {
    this.message = message;
  }


  public ValidationRule active(Boolean active) {
    
    this.active = active;
    return this;
  }

   /**
   * Whether or not this rule is active, meaning it should be applied.
   * @return active
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Whether or not this rule is active, meaning it should be applied.")
  @JsonProperty(JSON_PROPERTY_ACTIVE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Boolean getActive() {
    return active;
  }


  @JsonProperty(JSON_PROPERTY_ACTIVE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setActive(Boolean active) {
    this.active = active;
  }


  public ValidationRule messageKey(String messageKey) {
    
    this.messageKey = messageKey;
    return this;
  }

   /**
   * The message key for this rule
   * @return messageKey
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The message key for this rule")
  @JsonProperty(JSON_PROPERTY_MESSAGE_KEY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getMessageKey() {
    return messageKey;
  }


  @JsonProperty(JSON_PROPERTY_MESSAGE_KEY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMessageKey(String messageKey) {
    this.messageKey = messageKey;
  }


  public ValidationRule options(Map<String, String> options) {
    
    this.options = options;
    return this;
  }

  public ValidationRule putOptionsItem(String key, String optionsItem) {
    if (this.options == null) {
      this.options = new HashMap<>();
    }
    this.options.put(key, optionsItem);
    return this;
  }

   /**
   * An array defining the custom parameters for this rule.
   * @return options
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "An array defining the custom parameters for this rule.")
  @JsonProperty(JSON_PROPERTY_OPTIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Map<String, String> getOptions() {
    return options;
  }


  @JsonProperty(JSON_PROPERTY_OPTIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setOptions(Map<String, String> options) {
    this.options = options;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ValidationRule validationRule = (ValidationRule) o;
    return Objects.equals(this.type, validationRule.type) &&
        Objects.equals(this.message, validationRule.message) &&
        Objects.equals(this.active, validationRule.active) &&
        Objects.equals(this.messageKey, validationRule.messageKey) &&
        Objects.equals(this.options, validationRule.options);
  }

  @Override
  public int hashCode() {
    return Objects.hash(type, message, active, messageKey, options);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ValidationRule {\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    message: ").append(toIndentedString(message)).append("\n");
    sb.append("    active: ").append(toIndentedString(active)).append("\n");
    sb.append("    messageKey: ").append(toIndentedString(messageKey)).append("\n");
    sb.append("    options: ").append(toIndentedString(options)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}

