// Copyright 2026 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 = "CardRecommendationsProto";

// 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.

message CardRecommendationsLoggingData {
  CardRecommendationRequest request = 1 [features = { field_presence: EXPLICIT }];

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

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

message CardRecommendationRequest {
  // The list of available cards.
  repeated CardContext cards = 1;

  // The URL of the merchant site.
  string merchant_url = 2 [features = { field_presence: EXPLICIT }];

  // The annotated page content of the checkout page.
  AnnotatedPageContent annotated_page_content = 4 [features = { field_presence: EXPLICIT }];

  reserved 3;
}

message CardContext {
  // The instrument ID of the card.
  int64 instrument_id = 1 [features = { field_presence: EXPLICIT }];

  // The name of the card product.
  string card_product_name = 2 [features = { field_presence: EXPLICIT }];

  // The optional card benefit string.
  string card_benefit = 3 [features = { field_presence: EXPLICIT }];
}

message CardRecommendationResponse {
  // The recommended cards, their rewards, and their rankings.
  repeated RecommendedCard recommendations = 1;
}

message RecommendedCard {
  // The instrument ID of the recommended card.
  int64 instrument_id = 1 [features = { field_presence: EXPLICIT }];

  // The calculated rewards.
  string calculated_reward = 2 [features = { field_presence: EXPLICIT }];

  // The rank of the card recommendation, with 1 being the best.
  int32 rank = 3 [features = { field_presence: EXPLICIT }];
}
