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

syntax = "proto2";

import "components/feed/core/proto/wire/action_type.proto";
import "components/feed/core/proto/wire/semantic_properties.proto";

package feedwire1;

option optimize_for = LITE_RUNTIME;

option java_package = "org.chromium.components.feed.core.proto.wire";
option java_outer_classname = "FeedActionQueryDataProto";

// The combination of FeedActionQueryData and FeedActionQueryDataItem provide a
// transport format that can send each unique action, id, content domain, table,
// and semantic properties exactly once. This de-duplication allows the maximum
// amount of data to be sent from the client in the absence of compression.
// This data can then be mapped back into ContentId and SemanticProperties with
// high fidelity.
message FeedActionQueryData {
  // The specific action that was performed on the client.
  optional Action action = 1;

  // A unique set of ids associated with the content.
  repeated fixed64 unique_id = 2;

  // A unique set of content domains associated with the content.
  repeated string unique_content_domain = 3;

  // A unique set of tables associated with the content.
  repeated string unique_table = 4;

  // A unique set of SemanticProperties associated with the content that the
  // action was performed on. This data is not altered by the client.
  repeated SemanticProperties unique_semantic_properties = 5;

  // The content that the action was performed on. The identity of the content
  // can be created by combining unique_id, unique_content_domain, and
  // unique_table.
  repeated FeedActionQueryDataItem feed_action_query_data_item = 6;
}

// Data describing the individual content that was acted upon.
message FeedActionQueryDataItem {
  // An index into the unique_id field in FeedActionQueryData.
  optional int32 id_index = 1;

  // An index into the unique_content_domain field in FeedActionQueryData.
  optional int32 content_domain_index = 2;

  // An index into the unique_table field in FeedActionQueryData.
  optional int32 table_index = 3;

  // An index into the unique_semantic_properties field in FeedActionQueryData.
  optional int32 semantic_properties_index = 4;
}

// Data describing the action that occurred on the client.
message Action {
  // The specific action that was performed.
  optional ActionType action_type = 1;
}
