// Copyright 2025 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 fcp.confidentialcompute;

import "fcp/client/event_time_range.proto";
import "fcp/protos/confidentialcompute/private_logger_uploads_config.proto";

option java_package = "com.google.intelligence.fcp.confidentialcompute";
option java_multiple_files = true;
option java_outer_classname = "TeePayloadMetadataOuterClass";

// Metadata about the encrypted payload that is generated by a TEE container.
message TeePayloadMetadata {
  // The event time range of the data in the payload.
  client.EventTimeRange event_time_range = 1;
  // The coarse-grained proxy for the privacy ID stored in the encrypted
  // payload.
  uint64 partition_key = 2;
}

// A set of named payload metadata.
message PayloadMetadataSet {
  // A map of string names to payload metadata generated by a TEE container. The
  // names match the names set in the MetadataContainerConfig and are used by
  // downstream pipeline stages to identify the correct metadata.
  map<string, TeePayloadMetadata> metadata = 1;
}

// Configuration for the metadata container.
message MetadataContainerConfig {
  // Named metadata configs. The keys are arbitrary string names that identify
  // the metadata config.
  map<string, MetadataConfig> metadata_configs = 1;
}

enum EventTimeGranularity {
  EVENT_TIME_GRANULARITY_UNSPECIFIED = 0;
  EVENT_TIME_GRANULARITY_DAY = 1;
}

// Configuration for generating a TeePayloadMetadata.
message MetadataConfig {
  uint64 num_partitions = 1;
  EventTimeGranularity event_time_range_granularity = 2;
}

message MetadataContainerInitializationConfig {
  string on_device_query_name = 3;
  reserved 1, 2;
}
