// Copyright 2020 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";

package feedwire;

option optimize_for = LITE_RUNTIME;

import "components/feed/core/proto/v2/wire/feature.proto";
import "components/feed/core/proto/v2/wire/in_place_update_handle.proto";
import "components/feed/core/proto/v2/wire/payload_metadata.proto";
import "components/feed/core/proto/v2/wire/render_data.proto";
import "components/feed/core/proto/v2/wire/templates.proto";
import "components/feed/core/proto/v2/wire/token.proto";

// An extensible operation to change the state of data on the client.
message DataOperation {
  // Next tag: 8

  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;

    // A token, capable of making a next page request.
    Token next_page_token = 5;

    // Information to help render the content in the response.
    RenderData render_data = 6;

    // A handle for updating one or more pieces of content in place.
    InPlaceUpdateHandle in_place_update_handle = 8;

    // A collection of templates.
    Templates templates = 4 [deprecated = true];
  }
}
