/*
 * 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.HashMap;
import java.util.List;
import java.util.Map;
import org.appng.openapi.model.ActionField;
import org.appng.openapi.model.Message;
import org.appng.openapi.model.Permission;
import org.appng.openapi.model.User;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 * An action, representing an executable operation.
 */
@ApiModel(description = "An action, representing an executable operation.")
@JsonPropertyOrder({
  Action.JSON_PROPERTY_SELF,
  Action.JSON_PROPERTY_EXECUTE,
  Action.JSON_PROPERTY_ID,
  Action.JSON_PROPERTY_EVENT_ID,
  Action.JSON_PROPERTY_TITLE,
  Action.JSON_PROPERTY_PARAMETERS,
  Action.JSON_PROPERTY_USER,
  Action.JSON_PROPERTY_MESSAGES,
  Action.JSON_PROPERTY_FIELDS,
  Action.JSON_PROPERTY_PERMISSIONS,
  Action.JSON_PROPERTY_ON_SUCCESS,
  Action.JSON_PROPERTY_APP_N_G_VERSION,
  Action.JSON_PROPERTY_APP_VERSION
})
@JsonTypeName("Action")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-03-20T12:57:48.851+01:00[Europe/Berlin]")
public class Action {
  public static final String JSON_PROPERTY_SELF = "_self";
  private String self;

  public static final String JSON_PROPERTY_EXECUTE = "_execute";
  private String execute;

  public static final String JSON_PROPERTY_ID = "id";
  private String id;

  public static final String JSON_PROPERTY_EVENT_ID = "event-id";
  private String eventId;

  public static final String JSON_PROPERTY_TITLE = "title";
  private String title;

  public static final String JSON_PROPERTY_PARAMETERS = "parameters";
  private Map<String, String> parameters = null;

  public static final String JSON_PROPERTY_USER = "user";
  private User user;

  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 static final String JSON_PROPERTY_PERMISSIONS = "permissions";
  private List<Permission> permissions = null;

  public static final String JSON_PROPERTY_ON_SUCCESS = "onSuccess";
  private String onSuccess;

  public static final String JSON_PROPERTY_APP_N_G_VERSION = "appNGVersion";
  private String appNGVersion = null;

  public static final String JSON_PROPERTY_APP_VERSION = "appVersion";
  private String appVersion = null;


  public Action self(String self) {
    
    this.self = self;
    return this;
  }

   /**
   * The URL of the action
   * @return self
  **/
  @ApiModelProperty(required = true, value = "The URL of the action")
  @JsonProperty(JSON_PROPERTY_SELF)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getSelf() {
    return self;
  }


  @JsonProperty(JSON_PROPERTY_SELF)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setSelf(String self) {
    this.self = self;
  }


  public Action execute(String execute) {
    
    this.execute = execute;
    return this;
  }

   /**
   * The URL to execute the action
   * @return execute
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The URL to execute the action")
  @JsonProperty(JSON_PROPERTY_EXECUTE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getExecute() {
    return execute;
  }


  @JsonProperty(JSON_PROPERTY_EXECUTE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setExecute(String execute) {
    this.execute = execute;
  }


  public Action id(String id) {
    
    this.id = id;
    return this;
  }

   /**
   * The Id of the action.
   * @return id
  **/
  @ApiModelProperty(required = true, value = "The Id of the action.")
  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getId() {
    return id;
  }


  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setId(String id) {
    this.id = id;
  }


  public Action eventId(String eventId) {
    
    this.eventId = eventId;
    return this;
  }

   /**
   * The event-Id of the action.
   * @return eventId
  **/
  @ApiModelProperty(required = true, value = "The event-Id of the action.")
  @JsonProperty(JSON_PROPERTY_EVENT_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getEventId() {
    return eventId;
  }


  @JsonProperty(JSON_PROPERTY_EVENT_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setEventId(String eventId) {
    this.eventId = eventId;
  }


  public Action title(String title) {
    
    this.title = title;
    return this;
  }

   /**
   * The title of the datasource.
   * @return title
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The title of the datasource.")
  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getTitle() {
    return title;
  }


  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setTitle(String title) {
    this.title = title;
  }


  public Action parameters(Map<String, String> parameters) {
    
    this.parameters = parameters;
    return this;
  }

  public Action putParametersItem(String key, String parametersItem) {
    if (this.parameters == null) {
      this.parameters = new HashMap<>();
    }
    this.parameters.put(key, parametersItem);
    return this;
  }

   /**
   * A list of parameters for the action
   * @return parameters
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A list of parameters for the action")
  @JsonProperty(JSON_PROPERTY_PARAMETERS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Map<String, String> getParameters() {
    return parameters;
  }


  @JsonProperty(JSON_PROPERTY_PARAMETERS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setParameters(Map<String, String> parameters) {
    this.parameters = parameters;
  }


  public Action user(User user) {
    
    this.user = user;
    return this;
  }

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

  public User getUser() {
    return user;
  }


  @JsonProperty(JSON_PROPERTY_USER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setUser(User user) {
    this.user = user;
  }


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

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

   /**
   * A list of messages.
   * @return messages
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A list of messages.")
  @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 Action fields(List<ActionField> fields) {
    
    this.fields = fields;
    return this;
  }

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

   /**
   * A list of action-fields.
   * @return fields
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A list of action-fields.")
  @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;
  }


  public Action permissions(List<Permission> permissions) {
    
    this.permissions = permissions;
    return this;
  }

  public Action addPermissionsItem(Permission permissionsItem) {
    if (this.permissions == null) {
      this.permissions = new ArrayList<>();
    }
    this.permissions.add(permissionsItem);
    return this;
  }

   /**
   * The permissions for this action.
   * @return permissions
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The permissions for this action.")
  @JsonProperty(JSON_PROPERTY_PERMISSIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<Permission> getPermissions() {
    return permissions;
  }


  @JsonProperty(JSON_PROPERTY_PERMISSIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setPermissions(List<Permission> permissions) {
    this.permissions = permissions;
  }


  public Action onSuccess(String onSuccess) {
    
    this.onSuccess = onSuccess;
    return this;
  }

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

  public String getOnSuccess() {
    return onSuccess;
  }


  @JsonProperty(JSON_PROPERTY_ON_SUCCESS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setOnSuccess(String onSuccess) {
    this.onSuccess = onSuccess;
  }


  public Action appNGVersion(String appNGVersion) {
    
    this.appNGVersion = appNGVersion;
    return this;
  }

   /**
   * The version of appNG
   * @return appNGVersion
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The version of appNG")
  @JsonProperty(JSON_PROPERTY_APP_N_G_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getAppNGVersion() {
    return appNGVersion;
  }


  @JsonProperty(JSON_PROPERTY_APP_N_G_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setAppNGVersion(String appNGVersion) {
    this.appNGVersion = appNGVersion;
  }


  public Action appVersion(String appVersion) {
    
    this.appVersion = appVersion;
    return this;
  }

   /**
   * The version of the application
   * @return appVersion
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The version of the application")
  @JsonProperty(JSON_PROPERTY_APP_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getAppVersion() {
    return appVersion;
  }


  @JsonProperty(JSON_PROPERTY_APP_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setAppVersion(String appVersion) {
    this.appVersion = appVersion;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Action action = (Action) o;
    return Objects.equals(this.self, action.self) &&
        Objects.equals(this.execute, action.execute) &&
        Objects.equals(this.id, action.id) &&
        Objects.equals(this.eventId, action.eventId) &&
        Objects.equals(this.title, action.title) &&
        Objects.equals(this.parameters, action.parameters) &&
        Objects.equals(this.user, action.user) &&
        Objects.equals(this.messages, action.messages) &&
        Objects.equals(this.fields, action.fields) &&
        Objects.equals(this.permissions, action.permissions) &&
        Objects.equals(this.onSuccess, action.onSuccess) &&
        Objects.equals(this.appNGVersion, action.appNGVersion) &&
        Objects.equals(this.appVersion, action.appVersion);
  }

  @Override
  public int hashCode() {
    return Objects.hash(self, execute, id, eventId, title, parameters, user, messages, fields, permissions, onSuccess, appNGVersion, appVersion);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Action {\n");
    sb.append("    self: ").append(toIndentedString(self)).append("\n");
    sb.append("    execute: ").append(toIndentedString(execute)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    eventId: ").append(toIndentedString(eventId)).append("\n");
    sb.append("    title: ").append(toIndentedString(title)).append("\n");
    sb.append("    parameters: ").append(toIndentedString(parameters)).append("\n");
    sb.append("    user: ").append(toIndentedString(user)).append("\n");
    sb.append("    messages: ").append(toIndentedString(messages)).append("\n");
    sb.append("    fields: ").append(toIndentedString(fields)).append("\n");
    sb.append("    permissions: ").append(toIndentedString(permissions)).append("\n");
    sb.append("    onSuccess: ").append(toIndentedString(onSuccess)).append("\n");
    sb.append("    appNGVersion: ").append(toIndentedString(appNGVersion)).append("\n");
    sb.append("    appVersion: ").append(toIndentedString(appVersion)).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    ");
  }

}

