// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";

package cobalt;

import "common.proto";
import "observation_batch.proto";

option java_multiple_files = true;
option java_package = "com.google.cobalt";

////////////////////////////////////////////////////////////////////////////////
// NOTE: This file is used by the Cobalt client and the Cobalt servers.
// The source-of-truth of this file is located in Cobalt's open source code
// repository, and the file is copied to Android where it is used by the Cobalt
// client. Do not edit the copy of this file in this Android repo as those edits
// will be overwritten when the file is next copied.
////////////////////////////////////////////////////////////////////////////////

// An envelope contains multiple ObservationBatches. An encrypted Envelope
// is the unit sent from an Encoder client to a Shuffler.
message Envelope {
  // For a while, system profiles were included in each observation batch. They
  // are now once again included in the envelope to reduce costs. See
  // b/373463829.
  reserved 3;
  reserved "system_profile";

  repeated ObservationBatch batch = 1;

  // Each ObservationBatch will contain an integer index that indicates which
  // entry in `system_profiles` applies to that batch. Each system profile will
  // be unique and may be shared by multiple batches.
  repeated SystemProfile system_profiles = 5;

  // If api_key contains the right secret string, this allows Cobalt to identify
  // that this envelope comes from a valid Cobalt client.
  bytes api_key = 4;
}
