/*
 * 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.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.appng.openapi.model.ActionLink;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 * A link.
 */
@ApiModel(description = "A link.")
@JsonPropertyOrder({
  Link.JSON_PROPERTY_TYPE,
  Link.JSON_PROPERTY_ID,
  Link.JSON_PROPERTY_LABEL,
  Link.JSON_PROPERTY_TARGET,
  Link.JSON_PROPERTY_ICON,
  Link.JSON_PROPERTY_DEFAULT,
  Link.JSON_PROPERTY_CONFIRMATION
})
@JsonTypeName("Link")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-03-20T12:57:48.851+01:00[Europe/Berlin]")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "linkType", visible = true)
@JsonSubTypes({
  @JsonSubTypes.Type(value = ActionLink.class, name = "ActionLink"),
})

public class Link {
  /**
   * * page - Links to a page. * extern - Links to an external resource. * intern - Links to an internal resource. * action - Links to an action. * datasource - Links to a datasource 
   */
  public enum TypeEnum {
    PAGE("page"),
    
    EXTERN("extern"),
    
    INTERN("intern"),
    
    ACTION("action"),
    
    DATASOURCE("datasource");

    private String value;

    TypeEnum(String value) {
      this.value = value;
    }

    @JsonValue
    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static TypeEnum fromValue(String value) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }
  }

  public static final String JSON_PROPERTY_TYPE = "type";
  private TypeEnum type;

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

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

  public static final String JSON_PROPERTY_TARGET = "target";
  private String target;

  public static final String JSON_PROPERTY_ICON = "icon";
  private String icon;

  public static final String JSON_PROPERTY_DEFAULT = "default";
  private Boolean _default;

  public static final String JSON_PROPERTY_CONFIRMATION = "confirmation";
  private String confirmation;


  public Link type(TypeEnum type) {
    
    this.type = type;
    return this;
  }

   /**
   * * page - Links to a page. * extern - Links to an external resource. * intern - Links to an internal resource. * action - Links to an action. * datasource - Links to a datasource 
   * @return type
  **/
  @ApiModelProperty(required = true, value = "* page - Links to a page. * extern - Links to an external resource. * intern - Links to an internal resource. * action - Links to an action. * datasource - Links to a datasource ")
  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public TypeEnum getType() {
    return type;
  }


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


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

   /**
   * The ID for this link.
   * @return id
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The ID for this link.")
  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getId() {
    return id;
  }


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


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

   /**
   * The label for the link.
   * @return label
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The label for the link.")
  @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 Link target(String target) {
    
    this.target = target;
    return this;
  }

   /**
   * The target for the link.
   * @return target
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The target for the link.")
  @JsonProperty(JSON_PROPERTY_TARGET)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getTarget() {
    return target;
  }


  @JsonProperty(JSON_PROPERTY_TARGET)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setTarget(String target) {
    this.target = target;
  }


  public Link icon(String icon) {
    
    this.icon = icon;
    return this;
  }

   /**
   * A descriptive name for an icon that should be used for this link.
   * @return icon
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A descriptive name for an icon that should be used for this link.")
  @JsonProperty(JSON_PROPERTY_ICON)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getIcon() {
    return icon;
  }


  @JsonProperty(JSON_PROPERTY_ICON)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setIcon(String icon) {
    this.icon = icon;
  }


  public Link _default(Boolean _default) {
    
    this._default = _default;
    return this;
  }

   /**
   * Whether or not this link should be considered as default.
   * @return _default
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Whether or not this link should be considered as default.")
  @JsonProperty(JSON_PROPERTY_DEFAULT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Boolean getDefault() {
    return _default;
  }


  @JsonProperty(JSON_PROPERTY_DEFAULT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setDefault(Boolean _default) {
    this._default = _default;
  }


  public Link confirmation(String confirmation) {
    
    this.confirmation = confirmation;
    return this;
  }

   /**
   * A confirmation message that should be displayed to the user before following this link.
   * @return confirmation
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A confirmation message that should be displayed to the user before following this link.")
  @JsonProperty(JSON_PROPERTY_CONFIRMATION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getConfirmation() {
    return confirmation;
  }


  @JsonProperty(JSON_PROPERTY_CONFIRMATION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setConfirmation(String confirmation) {
    this.confirmation = confirmation;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Link link = (Link) o;
    return Objects.equals(this.type, link.type) &&
        Objects.equals(this.id, link.id) &&
        Objects.equals(this.label, link.label) &&
        Objects.equals(this.target, link.target) &&
        Objects.equals(this.icon, link.icon) &&
        Objects.equals(this._default, link._default) &&
        Objects.equals(this.confirmation, link.confirmation);
  }

  @Override
  public int hashCode() {
    return Objects.hash(type, id, label, target, icon, _default, confirmation);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Link {\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    label: ").append(toIndentedString(label)).append("\n");
    sb.append("    target: ").append(toIndentedString(target)).append("\n");
    sb.append("    icon: ").append(toIndentedString(icon)).append("\n");
    sb.append("    _default: ").append(toIndentedString(_default)).append("\n");
    sb.append("    confirmation: ").append(toIndentedString(confirmation)).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    ");
  }

}

