/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.cloudsearch.v1.model;

/**
 * Model definition for Segment.
 *
 * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Search API. For a detailed explanation see:
 * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
 * </p>
 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Segment extends com.google.api.client.json.GenericJson {

  /**
   * Formatting to be applied when rendering the Segment. For all segment types, this is the
   * standard way of representing that the Segment should be rendered in bold, italics, etc.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Formatting formatting;

  /**
   * For HASHTAG type:
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private HashtagData hashtagData;

  /**
   * Type-specific metadata. At most one of these should be populated, and the one that is populated
   * should correspond to the type of the Segment. For LINK type:
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private LinkData linkData;

  /**
   * For SEARCH_LINK type:
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private SearchLinkData searchLinkData;

  /**
   * Text content of the Segment. As a general rule, this field should contain the actual text that
   * should be rendered in the UI. Thus, for a hashtag, it should be "#Foo", and for a link, it
   * should be the display text. Clients that do not understand a particular segment type may use
   * this text, along with the Formatting info below, as a fallback for display. The field is not
   * required -- if all relevant information is carried in other metadata fields and there is no
   * need for a fallback, or it is not practical for a fallback to be provided for any other reason,
   * the field may be left blank. A standard example would be a user reference being transmitted
   * between server layers, where a gaia-ID representation may be sufficient and there is no need
   * for a textual fallback. In such a case, it would be valid and useful - though not required -
   * for servers to compute and populate a fallback on the serving path.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String text;

  /**
   * Type of Segment.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String type;

  /**
   * For USER_MENTION type:
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private UserMentionData userMentionData;

  /**
   * Formatting to be applied when rendering the Segment. For all segment types, this is the
   * standard way of representing that the Segment should be rendered in bold, italics, etc.
   * @return value or {@code null} for none
   */
  public Formatting getFormatting() {
    return formatting;
  }

  /**
   * Formatting to be applied when rendering the Segment. For all segment types, this is the
   * standard way of representing that the Segment should be rendered in bold, italics, etc.
   * @param formatting formatting or {@code null} for none
   */
  public Segment setFormatting(Formatting formatting) {
    this.formatting = formatting;
    return this;
  }

  /**
   * For HASHTAG type:
   * @return value or {@code null} for none
   */
  public HashtagData getHashtagData() {
    return hashtagData;
  }

  /**
   * For HASHTAG type:
   * @param hashtagData hashtagData or {@code null} for none
   */
  public Segment setHashtagData(HashtagData hashtagData) {
    this.hashtagData = hashtagData;
    return this;
  }

  /**
   * Type-specific metadata. At most one of these should be populated, and the one that is populated
   * should correspond to the type of the Segment. For LINK type:
   * @return value or {@code null} for none
   */
  public LinkData getLinkData() {
    return linkData;
  }

  /**
   * Type-specific metadata. At most one of these should be populated, and the one that is populated
   * should correspond to the type of the Segment. For LINK type:
   * @param linkData linkData or {@code null} for none
   */
  public Segment setLinkData(LinkData linkData) {
    this.linkData = linkData;
    return this;
  }

  /**
   * For SEARCH_LINK type:
   * @return value or {@code null} for none
   */
  public SearchLinkData getSearchLinkData() {
    return searchLinkData;
  }

  /**
   * For SEARCH_LINK type:
   * @param searchLinkData searchLinkData or {@code null} for none
   */
  public Segment setSearchLinkData(SearchLinkData searchLinkData) {
    this.searchLinkData = searchLinkData;
    return this;
  }

  /**
   * Text content of the Segment. As a general rule, this field should contain the actual text that
   * should be rendered in the UI. Thus, for a hashtag, it should be "#Foo", and for a link, it
   * should be the display text. Clients that do not understand a particular segment type may use
   * this text, along with the Formatting info below, as a fallback for display. The field is not
   * required -- if all relevant information is carried in other metadata fields and there is no
   * need for a fallback, or it is not practical for a fallback to be provided for any other reason,
   * the field may be left blank. A standard example would be a user reference being transmitted
   * between server layers, where a gaia-ID representation may be sufficient and there is no need
   * for a textual fallback. In such a case, it would be valid and useful - though not required -
   * for servers to compute and populate a fallback on the serving path.
   * @return value or {@code null} for none
   */
  public java.lang.String getText() {
    return text;
  }

  /**
   * Text content of the Segment. As a general rule, this field should contain the actual text that
   * should be rendered in the UI. Thus, for a hashtag, it should be "#Foo", and for a link, it
   * should be the display text. Clients that do not understand a particular segment type may use
   * this text, along with the Formatting info below, as a fallback for display. The field is not
   * required -- if all relevant information is carried in other metadata fields and there is no
   * need for a fallback, or it is not practical for a fallback to be provided for any other reason,
   * the field may be left blank. A standard example would be a user reference being transmitted
   * between server layers, where a gaia-ID representation may be sufficient and there is no need
   * for a textual fallback. In such a case, it would be valid and useful - though not required -
   * for servers to compute and populate a fallback on the serving path.
   * @param text text or {@code null} for none
   */
  public Segment setText(java.lang.String text) {
    this.text = text;
    return this;
  }

  /**
   * Type of Segment.
   * @return value or {@code null} for none
   */
  public java.lang.String getType() {
    return type;
  }

  /**
   * Type of Segment.
   * @param type type or {@code null} for none
   */
  public Segment setType(java.lang.String type) {
    this.type = type;
    return this;
  }

  /**
   * For USER_MENTION type:
   * @return value or {@code null} for none
   */
  public UserMentionData getUserMentionData() {
    return userMentionData;
  }

  /**
   * For USER_MENTION type:
   * @param userMentionData userMentionData or {@code null} for none
   */
  public Segment setUserMentionData(UserMentionData userMentionData) {
    this.userMentionData = userMentionData;
    return this;
  }

  @Override
  public Segment set(String fieldName, Object value) {
    return (Segment) super.set(fieldName, value);
  }

  @Override
  public Segment clone() {
    return (Segment) super.clone();
  }

}
