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

edition = "2023";

package optimization_guide.proto;

import "components/optimization_guide/proto/features/common_quality_data.proto";

import "components/optimization_guide/proto/model_quality_metadata.proto";

option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.features.proto";

option java_outer_classname = "WallpaperSearchProto";

// DO NOT EDIT THIS FILE DIRECTLY!
//
// This file is generated in g3 and then synced to Chrome. Instead, please refer to
// http://go/chrome-mqls-onboarding (Google-internal link), and then changes will
// be synced with Chrome automatically.

// Next ID: 6
message WallpaperSearchLoggingData {
  WallpaperSearchRequest request = 1 [features = { field_presence: EXPLICIT }];

  WallpaperSearchResponse response = 2 [features = { field_presence: EXPLICIT }];

  WallpaperSearchQuality quality = 3 [features = { field_presence: EXPLICIT }];

  ModelExecutionInfo model_execution_info = 4 [features = { field_presence: EXPLICIT }];

  reserved 5;
}

// Next ID: 3
message WallpaperSearchRequest {
  // The prompt built by selectors.
  Descriptors descriptors = 2;

  reserved 1;
}

// Next ID: 5
message Descriptors {
  // The subject to be featured.
  string subject = 1 [features = { field_presence: IMPLICIT }];

  // The art style of the image.
  string style = 2 [features = { field_presence: IMPLICIT }];

  // The general mood of the image.
  string mood = 3 [features = { field_presence: IMPLICIT }];

  // A color to be featured in the image.
  string color = 4 [features = { field_presence: IMPLICIT }];
}

// Next ID: 3
message WallpaperSearchResponse {
  // The images returned for the request.
  repeated Image images = 2;

  reserved 1;
}

// Next ID: 3
message Image {
  bytes encoded_image = 1 [features = { field_presence: IMPLICIT }];

  int64 image_id = 2 [features = { field_presence: IMPLICIT }];
}

// Data logged for each Theme Response by a client.
// Next ID: 8
message WallpaperSearchQuality {
  // A session starts when opening Panorama and ends when closing Panorama.
  // Multiple WallpaperSearchQuality can have the same session_id.
  int64 session_id = 1 [features = { field_presence: IMPLICIT }];

  // Per image data.
  repeated WallpaperSearchImageQuality images_quality = 2;

  // Index, in chronological order, of the returned Themes Set within one
  // session.
  int32 index = 3 [features = { field_presence: IMPLICIT }];

  // Whether the user thumbs upped or downed the Theme Set.
  UserFeedback user_feedback = 4 [features = { field_presence: IMPLICIT }];

  // False, if the user clicked regenerate when this Theme Response was shown.
  // True, if the user ended the Session while this Theme Response was shown.
  bool final_request_in_session = 5 [features = { field_presence: IMPLICIT }];

  // Duration, in milliseconds, from requesting the Theme Response until the
  // response arrives at the client.
  int32 request_latency_ms = 6 [features = { field_presence: IMPLICIT }];

  // Duration, in milliseconds, from showing Theme Response until the user
  // regenerates or ends the Session.
  int32 complete_latency_ms = 7 [features = { field_presence: IMPLICIT }];
}

// Data logged for each Theme Image by client.
// Next ID: 5
message WallpaperSearchImageQuality {
  // ID associated with a specific model pipeline run. Each model pipeline run
  // has an ID and produces at most one image.
  int64 image_id = 1 [features = { field_presence: IMPLICIT }];

  // True, if the user selected the Theme Image from the Theme Response so it
  // appears on their NTP.
  bool previewed = 2 [features = { field_presence: IMPLICIT }];

  // True, if the Theme Image was selected as the background when the Session
  // ends.
  bool selected = 3 [features = { field_presence: IMPLICIT }];

  // Duration, in milliseconds, from showing the Theme Image until the user
  // previews the Theme Image. Only set if "selected" is true.
  int32 preview_latency_ms = 4 [features = { field_presence: EXPLICIT }];
}
