/*
 * 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.ArrayList;
import java.util.List;
import org.appng.openapi.model.FieldType;
import org.appng.openapi.model.Message;
import org.appng.openapi.model.Options;
import org.appng.openapi.model.ValidationRule;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 * A single field as a part of an action.
 */
@ApiModel(description = "A single field as a part of an action.")
@JsonPropertyOrder({
  ActionField.JSON_PROPERTY_NAME,
  ActionField.JSON_PROPERTY_VALUE,
  ActionField.JSON_PROPERTY_LABEL,
  ActionField.JSON_PROPERTY_FIELD_TYPE,
  ActionField.JSON_PROPERTY_READONLY,
  ActionField.JSON_PROPERTY_VISIBLE,
  ActionField.JSON_PROPERTY_FORMAT,
  ActionField.JSON_PROPERTY_FORMATTED_VALUE,
  ActionField.JSON_PROPERTY_OPTIONS,
  ActionField.JSON_PROPERTY_RULES,
  ActionField.JSON_PROPERTY_MESSAGES,
  ActionField.JSON_PROPERTY_FIELDS
})
@JsonTypeName("ActionField")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-09-06T11:11:26.226947+02:00[Europe/Berlin]")
public class ActionField {
  public static final String JSON_PROPERTY_NAME = "name";
  private String name;

  public static final String JSON_PROPERTY_VALUE = "value";
  private Object value;

  public static final String JSON_PROPERTY_LABEL = "label";
  private String label;

  public static final String JSON_PROPERTY_FIELD_TYPE = "fieldType";
  private FieldType fieldType;

  public static final String JSON_PROPERTY_READONLY = "readonly";
  private Boolean readonly;

  public static final String JSON_PROPERTY_VISIBLE = "visible";
  private Boolean visible;

  public static final String JSON_PROPERTY_FORMAT = "format";
  private String format;

  public static final String JSON_PROPERTY_FORMATTED_VALUE = "formattedValue";
  private String formattedValue;

  public static final String JSON_PROPERTY_OPTIONS = "options";
  private Options options;

  public static final String JSON_PROPERTY_RULES = "rules";
  private List<ValidationRule> rules = null;

  public static final String JSON_PROPERTY_MESSAGES = "messages";
  private List<Message> messages = null;

  public static final String JSON_PROPERTY_FIELDS = "fields";
  private List<ActionField> fields = null;


  public ActionField name(String name) {
    
    this.name = name;
    return this;
  }

   /**
   * The name of the field.
   * @return name
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The name of the field.")
  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getName() {
    return name;
  }


  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setName(String name) {
    this.name = name;
  }


  public ActionField value(Object value) {
    
    this.value = value;
    return this;
  }

   /**
   * The value of the field. The concrete type of that object depends on the fieldType of this field.
   * @return value
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The value of the field. The concrete type of that object depends on the fieldType of this field.")
  @JsonProperty(JSON_PROPERTY_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Object getValue() {
    return value;
  }


  @JsonProperty(JSON_PROPERTY_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setValue(Object value) {
    this.value = value;
  }


  public ActionField label(String label) {
    
    this.label = label;
    return this;
  }

   /**
   * The label for the field.
   * @return label
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The label for the field.")
  @JsonProperty(JSON_PROPERTY_LABEL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getLabel() {
    return label;
  }


  @JsonProperty(JSON_PROPERTY_LABEL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setLabel(String label) {
    this.label = label;
  }


  public ActionField fieldType(FieldType fieldType) {
    
    this.fieldType = fieldType;
    return this;
  }

   /**
   * Get fieldType
   * @return fieldType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")
  @JsonProperty(JSON_PROPERTY_FIELD_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public FieldType getFieldType() {
    return fieldType;
  }


  @JsonProperty(JSON_PROPERTY_FIELD_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFieldType(FieldType fieldType) {
    this.fieldType = fieldType;
  }


  public ActionField readonly(Boolean readonly) {
    
    this.readonly = readonly;
    return this;
  }

   /**
   * Whether or not this field is read-only.
   * @return readonly
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Whether or not this field is read-only.")
  @JsonProperty(JSON_PROPERTY_READONLY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Boolean getReadonly() {
    return readonly;
  }


  @JsonProperty(JSON_PROPERTY_READONLY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setReadonly(Boolean readonly) {
    this.readonly = readonly;
  }


  public ActionField visible(Boolean visible) {
    
    this.visible = visible;
    return this;
  }

   /**
   * Whether or not this field should be visible.
   * @return visible
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Whether or not this field should be visible.")
  @JsonProperty(JSON_PROPERTY_VISIBLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Boolean getVisible() {
    return visible;
  }


  @JsonProperty(JSON_PROPERTY_VISIBLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setVisible(Boolean visible) {
    this.visible = visible;
  }


  public ActionField format(String format) {
    
    this.format = format;
    return this;
  }

   /**
   * The format for this field, depending on its type.
   * @return format
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The format for this field, depending on its type.")
  @JsonProperty(JSON_PROPERTY_FORMAT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getFormat() {
    return format;
  }


  @JsonProperty(JSON_PROPERTY_FORMAT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFormat(String format) {
    this.format = format;
  }


  public ActionField formattedValue(String formattedValue) {
    
    this.formattedValue = formattedValue;
    return this;
  }

   /**
   * The formatted value for this field.
   * @return formattedValue
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The formatted value for this field.")
  @JsonProperty(JSON_PROPERTY_FORMATTED_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getFormattedValue() {
    return formattedValue;
  }


  @JsonProperty(JSON_PROPERTY_FORMATTED_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFormattedValue(String formattedValue) {
    this.formattedValue = formattedValue;
  }


  public ActionField options(Options options) {
    
    this.options = options;
    return this;
  }

   /**
   * Get options
   * @return options
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")
  @JsonProperty(JSON_PROPERTY_OPTIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Options getOptions() {
    return options;
  }


  @JsonProperty(JSON_PROPERTY_OPTIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setOptions(Options options) {
    this.options = options;
  }


  public ActionField rules(List<ValidationRule> rules) {
    
    this.rules = rules;
    return this;
  }

  public ActionField addRulesItem(ValidationRule rulesItem) {
    if (this.rules == null) {
      this.rules = new ArrayList<>();
    }
    this.rules.add(rulesItem);
    return this;
  }

   /**
   * The validation rules that should be applied for this field.
   * @return rules
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The validation rules that should be applied for this field.")
  @JsonProperty(JSON_PROPERTY_RULES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<ValidationRule> getRules() {
    return rules;
  }


  @JsonProperty(JSON_PROPERTY_RULES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setRules(List<ValidationRule> rules) {
    this.rules = rules;
  }


  public ActionField messages(List<Message> messages) {
    
    this.messages = messages;
    return this;
  }

  public ActionField addMessagesItem(Message messagesItem) {
    if (this.messages == null) {
      this.messages = new ArrayList<>();
    }
    this.messages.add(messagesItem);
    return this;
  }

   /**
   * The messages related to this field.
   * @return messages
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The messages related to this field.")
  @JsonProperty(JSON_PROPERTY_MESSAGES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<Message> getMessages() {
    return messages;
  }


  @JsonProperty(JSON_PROPERTY_MESSAGES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMessages(List<Message> messages) {
    this.messages = messages;
  }


  public ActionField fields(List<ActionField> fields) {
    
    this.fields = fields;
    return this;
  }

  public ActionField addFieldsItem(ActionField fieldsItem) {
    if (this.fields == null) {
      this.fields = new ArrayList<>();
    }
    this.fields.add(fieldsItem);
    return this;
  }

   /**
   * The child fields of this fieldValue.
   * @return fields
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The child fields of this fieldValue.")
  @JsonProperty(JSON_PROPERTY_FIELDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<ActionField> getFields() {
    return fields;
  }


  @JsonProperty(JSON_PROPERTY_FIELDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFields(List<ActionField> fields) {
    this.fields = fields;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ActionField actionField = (ActionField) o;
    return Objects.equals(this.name, actionField.name) &&
        Objects.equals(this.value, actionField.value) &&
        Objects.equals(this.label, actionField.label) &&
        Objects.equals(this.fieldType, actionField.fieldType) &&
        Objects.equals(this.readonly, actionField.readonly) &&
        Objects.equals(this.visible, actionField.visible) &&
        Objects.equals(this.format, actionField.format) &&
        Objects.equals(this.formattedValue, actionField.formattedValue) &&
        Objects.equals(this.options, actionField.options) &&
        Objects.equals(this.rules, actionField.rules) &&
        Objects.equals(this.messages, actionField.messages) &&
        Objects.equals(this.fields, actionField.fields);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, value, label, fieldType, readonly, visible, format, formattedValue, options, rules, messages, fields);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ActionField {\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    value: ").append(toIndentedString(value)).append("\n");
    sb.append("    label: ").append(toIndentedString(label)).append("\n");
    sb.append("    fieldType: ").append(toIndentedString(fieldType)).append("\n");
    sb.append("    readonly: ").append(toIndentedString(readonly)).append("\n");
    sb.append("    visible: ").append(toIndentedString(visible)).append("\n");
    sb.append("    format: ").append(toIndentedString(format)).append("\n");
    sb.append("    formattedValue: ").append(toIndentedString(formattedValue)).append("\n");
    sb.append("    options: ").append(toIndentedString(options)).append("\n");
    sb.append("    rules: ").append(toIndentedString(rules)).append("\n");
    sb.append("    messages: ").append(toIndentedString(messages)).append("\n");
    sb.append("    fields: ").append(toIndentedString(fields)).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    ");
  }

}

