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

// Data models to interface with Wallet API v1.

syntax = "proto2";

package wallet.api;

import "client_info.proto";
import "common.proto";
import "pass.proto";
import "private_pass.proto";

option optimize_for = LITE_RUNTIME;

// Request to get private passes.
message GetPrivatePassesRequest {
  // The identifier of the private passes to get.
  repeated string pass_ids = 1;

  // Information about the client making the request.
  optional ClientInfo client_info = 2;
}

// The result of getting a private pass request.
message GetPrivatePassResult {
  // The identifier of the private pass.
  optional string pass_id = 1;

  // The result of the get private pass. Either a pass or an error.
  oneof result {
    // The private pass if the request succeeded.
    PrivatePass private_pass = 2;

    // The error if we failed to get the private pass.
    RpcStatus error = 3;
  }
}

// Response to get private passes request.
message GetPrivatePassesResponse {
  // The results of the get private passes request.
  repeated GetPrivatePassResult results = 1;
}

// Request for the UpsertPrivatePass RPC.
message UpsertPrivatePassRequest {
  // Pass to upsert.
  optional PrivatePass private_pass = 1;

  // Information about the client making the request.
  optional ClientInfo client_info = 2;

  // A copy of id.consent.audit.common.SessionId.
  // Represents a 128-bit version 4 UUID that identifies a consent.
  // Whenever a new private pass is saved from Chrome, the user's consent to
  // share this data is logged through the USER_CONSENTS sync data type. The
  // SessionId identifying this consent is then attached to the upsert call.
  message SessionId {
    message UUID {
      optional uint64 most_significant_uuid_bits = 1;
      optional uint64 least_significant_uuid_bits = 2;
    }
    optional UUID uuid = 1;
  }
  optional SessionId session_id = 3;
}

// Response for the UpsertPrivatePass RPC.
message UpsertPrivatePassResponse {
  // The created or updated pass.
  optional PrivatePass private_pass = 3;

  reserved 1, 2;
}

// Request for the UpsertPass RPC.
message UpsertPassRequest {
  // Pass to upsert.
  optional Pass pass = 1;

  // Information about the client making the request.
  optional ClientInfo client_info = 2;
}

// Response for the UpsertPass RPC.
message UpsertPassResponse {
  // The unique identifier of the created or updated pass.
  optional string pass_id = 1;
}
