/*
 * 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.contentwarehouse.v1.model;

/**
 * Contains meta information about this data. This field is only available in docjoins (and
 * potentially MDU shards), it is not populated offline. NOTE: This is a new field (Nov 2022) and we
 * do not want clients to depend on this; please contact qscore-team@ if you want to use this
 * information.
 *
 * <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 Document AI Warehouse 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 QualityNsrNsrDataMetadata extends com.google.api.client.json.GenericJson {

  /**
   * Encoded lookup information. The fields set above are expensive to store. Storing them in
   * docjoins is fine, but we cannot store them in MDU shards. In order for the MDU shards to
   * display field provenance information, we store them as a bitfield. For details about the
   * encoding and decoding scheme, see quality_nsr::util::EncodeMetadataLookupInformation. We expect
   * this to occupy 8 bytes as long as there are less than 64 fields in NsrData proto, 12 bytes
   * between 64 and 92 fields, etc.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String encodedLookupInformation;

  /**
   * Same as raffia_lookup_key_per_field. Note that the goldmine_lookups have priority; if a field
   * appears in both goldmine and raffia entries, it means it was taken from goldmine. If it's
   * missing here but present in raffia_lookup_key_per_field, it was taken from raffia.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.Integer> goldmineLookupKeyPerField;

  /**
   * The lookup keys attempted by goldmine. Note that goldmine only runs for urls which can be
   * chunked differently than raffia; in those cases, goldmine related fields are empty.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<java.lang.String> goldmineLookupKeys;

  /**
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key @com.google.api.client.json.JsonString
  private java.lang.Long lastTimeProcessedGoldmineInSeconds;

  /**
   * This field is populated only during MDU population, so it's *not* present in docjoins, but it's
   * present in production so that it can be displayed.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key @com.google.api.client.json.JsonString
  private java.lang.Long lastTimeProcessedMduInSeconds;

  /**
   * Records the last time each system has processed the proto. These are recorded as seconds from
   * the unix epoch. Ideally these fields would be google.protobuf.Timestamp, but the scoring bundle
   * (which depends on this proto) does not understand proto3 syntax. See cl/500942047 for details.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key @com.google.api.client.json.JsonString
  private java.lang.Long lastTimeProcessedRaffiaInSeconds;

  /**
   * Stores the NSRChunks (computed by goldmine) which were used to populate the data.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private QualityNsrNsrChunksWithSourceInfo nsrChunksWithSourceInfo;

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

  /**
   * Returns the raffia lookup key per each field in the NsrData proto (with exclusion of the
   * Metadata sub-message (i.e. this)). It contains information like 3 : 1, meaning that the field
   * inside NsrData with id '3' (in this case 'host') has been taken by raffia from the raffia
   * lookup key at index 1.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.Integer> raffiaLookupKeyPerField;

  /**
   * This is an internal field set by Raffia, to indicate which lookup keys have been attempted to
   * populate the NsrData for this document. This will allow us to determine which key has been used
   * to populate each field in the proto. The keys are ordered by lookup priority; raffia will give
   * priority to earlier keys, and only take fields from later keys if they are missing.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<java.lang.String> raffiaLookupKeys;

  /**
   * The url used by NsrSignalMerger (http://google3/indexing/signals/signal-
   * merger.h;l=1801;rcl=509297232) to select which NsrData value to keep. The SignalMerger merges
   * all the NsrData coming from the dup url cluster, and select the NsrData value to return by
   * choosing a single url in the cluster (see NsrSignalMerger class for details). NOTE: This field
   * is populated only when there *is* a cluster. If there is no cluster, this is empty and the key
   * used is the canonical (and only) url.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String raffiaSignalMergerUrl;

  /**
   * Encoded lookup information. The fields set above are expensive to store. Storing them in
   * docjoins is fine, but we cannot store them in MDU shards. In order for the MDU shards to
   * display field provenance information, we store them as a bitfield. For details about the
   * encoding and decoding scheme, see quality_nsr::util::EncodeMetadataLookupInformation. We expect
   * this to occupy 8 bytes as long as there are less than 64 fields in NsrData proto, 12 bytes
   * between 64 and 92 fields, etc.
   * @see #decodeEncodedLookupInformation()
   * @return value or {@code null} for none
   */
  public java.lang.String getEncodedLookupInformation() {
    return encodedLookupInformation;
  }

  /**
   * Encoded lookup information. The fields set above are expensive to store. Storing them in
   * docjoins is fine, but we cannot store them in MDU shards. In order for the MDU shards to
   * display field provenance information, we store them as a bitfield. For details about the
   * encoding and decoding scheme, see quality_nsr::util::EncodeMetadataLookupInformation. We expect
   * this to occupy 8 bytes as long as there are less than 64 fields in NsrData proto, 12 bytes
   * between 64 and 92 fields, etc.
   * @see #getEncodedLookupInformation()
   * @return Base64 decoded value or {@code null} for none
   *
   * @since 1.14
   */
  public byte[] decodeEncodedLookupInformation() {
    return com.google.api.client.util.Base64.decodeBase64(encodedLookupInformation);
  }

  /**
   * Encoded lookup information. The fields set above are expensive to store. Storing them in
   * docjoins is fine, but we cannot store them in MDU shards. In order for the MDU shards to
   * display field provenance information, we store them as a bitfield. For details about the
   * encoding and decoding scheme, see quality_nsr::util::EncodeMetadataLookupInformation. We expect
   * this to occupy 8 bytes as long as there are less than 64 fields in NsrData proto, 12 bytes
   * between 64 and 92 fields, etc.
   * @see #encodeEncodedLookupInformation()
   * @param encodedLookupInformation encodedLookupInformation or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setEncodedLookupInformation(java.lang.String encodedLookupInformation) {
    this.encodedLookupInformation = encodedLookupInformation;
    return this;
  }

  /**
   * Encoded lookup information. The fields set above are expensive to store. Storing them in
   * docjoins is fine, but we cannot store them in MDU shards. In order for the MDU shards to
   * display field provenance information, we store them as a bitfield. For details about the
   * encoding and decoding scheme, see quality_nsr::util::EncodeMetadataLookupInformation. We expect
   * this to occupy 8 bytes as long as there are less than 64 fields in NsrData proto, 12 bytes
   * between 64 and 92 fields, etc.
   * @see #setEncodedLookupInformation()
   *
   * <p>
   * The value is encoded Base64 or {@code null} for none.
   * </p>
   *
   * @since 1.14
   */
  public QualityNsrNsrDataMetadata encodeEncodedLookupInformation(byte[] encodedLookupInformation) {
    this.encodedLookupInformation = com.google.api.client.util.Base64.encodeBase64URLSafeString(encodedLookupInformation);
    return this;
  }

  /**
   * Same as raffia_lookup_key_per_field. Note that the goldmine_lookups have priority; if a field
   * appears in both goldmine and raffia entries, it means it was taken from goldmine. If it's
   * missing here but present in raffia_lookup_key_per_field, it was taken from raffia.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.Integer> getGoldmineLookupKeyPerField() {
    return goldmineLookupKeyPerField;
  }

  /**
   * Same as raffia_lookup_key_per_field. Note that the goldmine_lookups have priority; if a field
   * appears in both goldmine and raffia entries, it means it was taken from goldmine. If it's
   * missing here but present in raffia_lookup_key_per_field, it was taken from raffia.
   * @param goldmineLookupKeyPerField goldmineLookupKeyPerField or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setGoldmineLookupKeyPerField(java.util.Map<String, java.lang.Integer> goldmineLookupKeyPerField) {
    this.goldmineLookupKeyPerField = goldmineLookupKeyPerField;
    return this;
  }

  /**
   * The lookup keys attempted by goldmine. Note that goldmine only runs for urls which can be
   * chunked differently than raffia; in those cases, goldmine related fields are empty.
   * @return value or {@code null} for none
   */
  public java.util.List<java.lang.String> getGoldmineLookupKeys() {
    return goldmineLookupKeys;
  }

  /**
   * The lookup keys attempted by goldmine. Note that goldmine only runs for urls which can be
   * chunked differently than raffia; in those cases, goldmine related fields are empty.
   * @param goldmineLookupKeys goldmineLookupKeys or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setGoldmineLookupKeys(java.util.List<java.lang.String> goldmineLookupKeys) {
    this.goldmineLookupKeys = goldmineLookupKeys;
    return this;
  }

  /**
   * @return value or {@code null} for none
   */
  public java.lang.Long getLastTimeProcessedGoldmineInSeconds() {
    return lastTimeProcessedGoldmineInSeconds;
  }

  /**
   * @param lastTimeProcessedGoldmineInSeconds lastTimeProcessedGoldmineInSeconds or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setLastTimeProcessedGoldmineInSeconds(java.lang.Long lastTimeProcessedGoldmineInSeconds) {
    this.lastTimeProcessedGoldmineInSeconds = lastTimeProcessedGoldmineInSeconds;
    return this;
  }

  /**
   * This field is populated only during MDU population, so it's *not* present in docjoins, but it's
   * present in production so that it can be displayed.
   * @return value or {@code null} for none
   */
  public java.lang.Long getLastTimeProcessedMduInSeconds() {
    return lastTimeProcessedMduInSeconds;
  }

  /**
   * This field is populated only during MDU population, so it's *not* present in docjoins, but it's
   * present in production so that it can be displayed.
   * @param lastTimeProcessedMduInSeconds lastTimeProcessedMduInSeconds or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setLastTimeProcessedMduInSeconds(java.lang.Long lastTimeProcessedMduInSeconds) {
    this.lastTimeProcessedMduInSeconds = lastTimeProcessedMduInSeconds;
    return this;
  }

  /**
   * Records the last time each system has processed the proto. These are recorded as seconds from
   * the unix epoch. Ideally these fields would be google.protobuf.Timestamp, but the scoring bundle
   * (which depends on this proto) does not understand proto3 syntax. See cl/500942047 for details.
   * @return value or {@code null} for none
   */
  public java.lang.Long getLastTimeProcessedRaffiaInSeconds() {
    return lastTimeProcessedRaffiaInSeconds;
  }

  /**
   * Records the last time each system has processed the proto. These are recorded as seconds from
   * the unix epoch. Ideally these fields would be google.protobuf.Timestamp, but the scoring bundle
   * (which depends on this proto) does not understand proto3 syntax. See cl/500942047 for details.
   * @param lastTimeProcessedRaffiaInSeconds lastTimeProcessedRaffiaInSeconds or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setLastTimeProcessedRaffiaInSeconds(java.lang.Long lastTimeProcessedRaffiaInSeconds) {
    this.lastTimeProcessedRaffiaInSeconds = lastTimeProcessedRaffiaInSeconds;
    return this;
  }

  /**
   * Stores the NSRChunks (computed by goldmine) which were used to populate the data.
   * @return value or {@code null} for none
   */
  public QualityNsrNsrChunksWithSourceInfo getNsrChunksWithSourceInfo() {
    return nsrChunksWithSourceInfo;
  }

  /**
   * Stores the NSRChunks (computed by goldmine) which were used to populate the data.
   * @param nsrChunksWithSourceInfo nsrChunksWithSourceInfo or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setNsrChunksWithSourceInfo(QualityNsrNsrChunksWithSourceInfo nsrChunksWithSourceInfo) {
    this.nsrChunksWithSourceInfo = nsrChunksWithSourceInfo;
    return this;
  }

  /**
   * @return value or {@code null} for none
   */
  public java.lang.String getRaffiaLookupKey() {
    return raffiaLookupKey;
  }

  /**
   * @param raffiaLookupKey raffiaLookupKey or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setRaffiaLookupKey(java.lang.String raffiaLookupKey) {
    this.raffiaLookupKey = raffiaLookupKey;
    return this;
  }

  /**
   * Returns the raffia lookup key per each field in the NsrData proto (with exclusion of the
   * Metadata sub-message (i.e. this)). It contains information like 3 : 1, meaning that the field
   * inside NsrData with id '3' (in this case 'host') has been taken by raffia from the raffia
   * lookup key at index 1.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.Integer> getRaffiaLookupKeyPerField() {
    return raffiaLookupKeyPerField;
  }

  /**
   * Returns the raffia lookup key per each field in the NsrData proto (with exclusion of the
   * Metadata sub-message (i.e. this)). It contains information like 3 : 1, meaning that the field
   * inside NsrData with id '3' (in this case 'host') has been taken by raffia from the raffia
   * lookup key at index 1.
   * @param raffiaLookupKeyPerField raffiaLookupKeyPerField or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setRaffiaLookupKeyPerField(java.util.Map<String, java.lang.Integer> raffiaLookupKeyPerField) {
    this.raffiaLookupKeyPerField = raffiaLookupKeyPerField;
    return this;
  }

  /**
   * This is an internal field set by Raffia, to indicate which lookup keys have been attempted to
   * populate the NsrData for this document. This will allow us to determine which key has been used
   * to populate each field in the proto. The keys are ordered by lookup priority; raffia will give
   * priority to earlier keys, and only take fields from later keys if they are missing.
   * @return value or {@code null} for none
   */
  public java.util.List<java.lang.String> getRaffiaLookupKeys() {
    return raffiaLookupKeys;
  }

  /**
   * This is an internal field set by Raffia, to indicate which lookup keys have been attempted to
   * populate the NsrData for this document. This will allow us to determine which key has been used
   * to populate each field in the proto. The keys are ordered by lookup priority; raffia will give
   * priority to earlier keys, and only take fields from later keys if they are missing.
   * @param raffiaLookupKeys raffiaLookupKeys or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setRaffiaLookupKeys(java.util.List<java.lang.String> raffiaLookupKeys) {
    this.raffiaLookupKeys = raffiaLookupKeys;
    return this;
  }

  /**
   * The url used by NsrSignalMerger (http://google3/indexing/signals/signal-
   * merger.h;l=1801;rcl=509297232) to select which NsrData value to keep. The SignalMerger merges
   * all the NsrData coming from the dup url cluster, and select the NsrData value to return by
   * choosing a single url in the cluster (see NsrSignalMerger class for details). NOTE: This field
   * is populated only when there *is* a cluster. If there is no cluster, this is empty and the key
   * used is the canonical (and only) url.
   * @return value or {@code null} for none
   */
  public java.lang.String getRaffiaSignalMergerUrl() {
    return raffiaSignalMergerUrl;
  }

  /**
   * The url used by NsrSignalMerger (http://google3/indexing/signals/signal-
   * merger.h;l=1801;rcl=509297232) to select which NsrData value to keep. The SignalMerger merges
   * all the NsrData coming from the dup url cluster, and select the NsrData value to return by
   * choosing a single url in the cluster (see NsrSignalMerger class for details). NOTE: This field
   * is populated only when there *is* a cluster. If there is no cluster, this is empty and the key
   * used is the canonical (and only) url.
   * @param raffiaSignalMergerUrl raffiaSignalMergerUrl or {@code null} for none
   */
  public QualityNsrNsrDataMetadata setRaffiaSignalMergerUrl(java.lang.String raffiaSignalMergerUrl) {
    this.raffiaSignalMergerUrl = raffiaSignalMergerUrl;
    return this;
  }

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

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

}
