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

// Keep in sync with
// http://google3/google/internal/communications/instantmessaging/v1/tachyon_common.proto
// Messages not used in Chrome have been omitted.

syntax = "proto3";

package nearbyshare.tachyon_proto;

option optimize_for = LITE_RUNTIME;

import "tachyon_enums.proto";

message Id {
  // type defines what the id field contains, e.g. phone number, Fi-number, Gaia
  // ID etc.
  IdType.Type type = 1;
  // id is a unique (for this type and app) identifier of a message source or
  // recipient.
  string id = 2;

  // app is the tachyon client application that generated or is to receive a
  // message.
  string app = 3;

  // location_hint is used as a hint for the user's region.
  LocationHint location_hint = 5;
}

// LocationHint is used to specify a location as well as format.
message LocationHint {
  // Location is the location, provided in the format specified by format.
  string location = 1;

  // the format of location.
  LocationStandard.Format format = 2;
}

// RequestHeader must be included in all request messages with the field name
// `header`.
// This will make the generated Go types of requests have GetHeader and
// SetHeader funcs, which makes it simple to create a common interface to access
// the header values.
message RequestHeader {
  // request_id identifies this request and its responses, must be unique, and
  // is generated by the request creator.
  // This does not need to be set if request_id_binary is set.
  string request_id = 1;

  // app identifies the application; this is used to isolate different
  // applications in the backend.
  string app = 3;

  // client_info holds information about the calling client application.
  ClientInfo client_info = 7;

  // requester_id is the user ID of the requester.
  Id requester_id = 10;
}

message ClientInfo {
  // major, minor, point and details carry version information from client.
  int32 major = 3;
  int32 minor = 4;
  int32 point = 5;

  // api_version identifies what api_version the client was built against.
  // This is used by server to:
  // - push warning messages to clients during bind
  // - fail RPCs if client is using a too old version
  // - add backwards compatible code
  ApiVersion.Value api_version = 7;

  // platform_type is the type of platform, used to construct user agent string
  // and to determine client node type in logging.
  Platform.Type platform_type = 9;

  // The APK version name (e.g. "4.0.006_RC2").
  // Fireball Android sends down the version code in the above major field and
  // leaves minor and point empty. The code results in a version that is tough
  // to decipher like "20011296.0.0". The version name here is formatted to make
  // versioning easier and safer on the server. Currently, this field is only
  // populated by Fireball Android. See go/fireball-gbot-version.
  string app_version = 10;
}
