// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package lens;

import "lens_overlay_routing_info.proto";

// Request Id definition to support request sequencing and state lookup.
// Next Id: 18
message LensOverlayRequestId {
  // A unique identifier for a sequence of related Lens requests.
  optional uint64 uuid = 1;

  // An id to indicate the order of the current request within a sequence of
  // requests sharing the same uuid. Starts from 1, increments by 1 if there is
  // a new request with the same uuid.
  optional int32 sequence_id = 2;

  // An id to indicate the order of image payload sent within a sequence of
  // requests sharing the same uuid. Starts from 1, increments by 1 if there is
  // a new request with an image payload with the same uuid.
  // Note, region search request does not increment this id.
  optional int32 image_sequence_id = 3;

  // Analytics ID for the Lens request. Will be updated on the initial request
  // and once per interaction request.
  optional bytes analytics_id = 4;

  // An id to indicate the order of contextual document payloads sent within a
  // sequence of requests sharing the same uuid. Starts from 1, increments by 1
  // if there is a new request with a contextual payload with the same uuid.
  optional int32 long_context_id = 9;

  // Information about where to route the request.
  optional LensOverlayRoutingInfo routing_info = 6;

  // The Epoch Micro Wall time when the request is built.
  optional uint64 time_usec = 7;

  enum MediaType {
    MEDIA_TYPE_DEFAULT_IMAGE = 0;
    MEDIA_TYPE_PDF = 1;
    MEDIA_TYPE_WEBPAGE = 2;
    MEDIA_TYPE_PDF_AND_IMAGE = 3;
    MEDIA_TYPE_WEBPAGE_AND_IMAGE = 4;
    MEDIA_TYPE_UNRESOLVED_URL = 5;
    // Media type for all file bytes upload. This needs to be set with mime_type
    // below.
    MEDIA_TYPE_RAW_FILE = 6;
    MEDIA_TYPE_UNRESOLVED = 7;
  }

  // The type of media this object represents.
  optional MediaType media_type = 10;

  // Identifier for the contextualized document in this request. Stable across
  // follow-up requests for the same document.
  optional int64 context_id = 12;

  // MIME type of file bytes. Only required for MEDIA_TYPE_RAW_FILE uploads.
  optional string mime_type = 13;

  // True if the context/media is derived from a Chrome tab.
  optional bool has_chrome_tab_data = 15;

  // Whether or not the request is for an implicit context upload.
  // e.g. a viewport screenshot from the Lens overlay contextual searchbox.
  optional bool is_implicit_upload = 16;

  // The drive id of the file in the request, if any.
  optional string drive_id = 17;
}
