// 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/feature.proto";
import "components/feed/core/proto/wire/payload_metadata.proto";
import "components/feed/core/proto/ui/piet/piet.proto";

package feedwire1;

option optimize_for = LITE_RUNTIME;

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

// An extensible operation to change the state of data on the client.
message DataOperation {
  enum Operation {
    UNKNOWN_OPERATION = 0;
    // Remove all stored content of all types
    CLEAR_ALL = 1;
    // Update content if it exists, else append to the bottom of the feed
    UPDATE_OR_APPEND = 2;
    // Remove the item from the stream
    REMOVE = 3;
  }

  // The operation to perform on the data.
  optional Operation operation = 1;

  // Data common to all payload types.
  optional PayloadMetadata metadata = 2;

  // The actual data being supplied.
  oneof payload {
    // A stream UI level feature such as a cluster or card.
    Feature feature = 3;
    // Shared state for all Piet cards
    components.feed.core.proto.ui.piet.PietSharedState piet_shared_state = 4;
  }
}
