syntax = "proto3";
package wechaty.puppet;

option go_package="github.com/wechaty/go-grpc/wechaty/puppet";
option java_package="io.github.wechaty.grpc.puppet";
option csharp_namespace = "github.wechaty.grpc.puppet";

import "google/protobuf/wrappers.proto";

enum ContactGender { // 性别枚举
  CONTACT_GENDER_UNSPECIFIED = 0; // 不明确
  CONTACT_GENDER_MALE        = 1; // 男
  CONTACT_GENDER_FEMALE      = 2; // 女
}

enum ContactType { // 类型枚举
  CONTACT_TYPE_UNSPECIFIED = 0; // 不明确
  CONTACT_TYPE_PERSONAL    = 1; // 个微联系人
  CONTACT_TYPE_OFFICIAL    = 2; // 公众号
  CONTACT_TYPE_CORPORATION = 3; // 企微联系人
  CONTACT_TYPE_APPLICATION = 4; // 应用联系人 例如小助手
}

message ContactListRequest {}
message ContactListResponse {
  repeated string ids = 1;
}

message ContactPayloadRequest {
  string id = 1;
}
message ContactPayloadResponse {
  string        id        = 1;
  ContactGender gender    = 2; // 性别
  ContactType   type      = 3; // 类型
  string        name      = 4; // 姓名
  string        avatar    = 5; // 头像
  string        address   = 6; // 地址
  string        alias     = 7; // 别名，即备注
  string        city      = 8; // 城市
  bool          friend    = 9; // 是否为好友
  string        province  = 10;// 省份
  string        signature = 11;// 签名
  bool          star      = 12;// 是否为特别好友
  /**
   * Huan(202203): in gRPC, we can freely rename the field name as long as the number keep consistent.
   *  so we can just rename `weixin` to `handle` here.
   *
   * (Huan(20220329): use `weixin` for now, until we upgrade to v2.0
   *  the `wechaty-grpc@1.0.0` will use the latest v1.x automatically when running `npm install`
   *    which will causing a breaking change.
   *  @link https://github.com/wechaty/getting-started/issues/254
   *
   * TODO: rename `weixin` to `handle` in v2.0.0
   */
  string   weixin          = 13;// IM专属id，在企微环境中特指weixinId
  string   corporation     = 14;// 企业
  string   title           = 15;// 头衔
  string   description     = 16;// 描述
  bool     coworker        = 17;// 是否为同事
  repeated string phones   = 18;// 电话号码，企微中最多5个
  string   additional_info = 19;// 额外信息，是由JS对象stringify得到的字符串，目前支持的内容包含addContactTime、corpId等。

  repeated string tag_ids = 20; // 标签（的id）

  string real_name = 21;
  string aka = 22;
}

message BatchContactPayloadRequest {
  repeated string ids = 1;
}

message BatchContactPayloadResponse {
  repeated ContactPayloadResponse contact_payloads = 1;
}

message ContactSelfQRCodeRequest {}
message ContactSelfQRCodeResponse {
  string qrcode = 1;
}

message ContactSelfNameRequest {
  string name = 1;
}
message ContactSelfNameResponse {}

message ContactSelfSignatureRequest {
  string signature = 1;
}
message ContactSelfSignatureResponse {}

message ContactSelfRoomAliasRequest {
  string room_id = 1;
  string alias = 2;
}

message ContactSelfRoomAliasResponse {}

message ContactSelfRealNameRequest {
  string real_name = 1;
}

message ContactSelfRealNameResponse {
}

message ContactSelfAkaRequest {
  string aka = 1;
}

message ContactSelfAkaResponse {
}

message ContactAliasRequest {
  string id = 1;
  // nullable
  google.protobuf.StringValue alias_string_value_deprecated = 2 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  optional string alias = 3;
}
message ContactAliasResponse {
  google.protobuf.StringValue alias_string_value_deprecated = 1 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  string alias = 2;
}

message ContactAvatarRequest {
  string id = 1;
  google.protobuf.StringValue filebox_string_value_deprecated = 2 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  optional string file_box = 3;
}
message ContactAvatarResponse {
  google.protobuf.StringValue filebox_string_value_deprecated = 1 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  string file_box = 2;
}

message ContactPhoneRequest {
  string contact_id = 1;
  repeated string phones = 2;
}

message ContactPhoneResponse {
  repeated string phones = 2;
}

message ContactCorporationRemarkRequest {
  string contact_id = 1;
  google.protobuf.StringValue corporation_remark_string_value_deprecated = 2 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  string corporation_remark = 3;
}

message ContactCorporationRemarkResponse {}

message ContactDescriptionRequest {
  string contact_id = 1;
  google.protobuf.StringValue description_string_value_deprecated = 2 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  string description = 3;
}

message ContactDescriptionResponse {}

message ContactDeleteRequest {
  string contact_id = 1;
}

message ContactDeleteResponse {}

message ContactPayloadModifyRequest {
  string        id              = 1;
  optional ContactGender gender          = 2;   // 性别
  optional ContactType   type            = 3;   // 类型
  optional string        name            = 4;   // 姓名
  optional string        avatar          = 5;   // 头像
  optional string        address         = 6;   // 地址
  optional string        alias           = 7;   // 别名，即备注
  optional string        city            = 8;   // 城市
  optional bool          friend          = 9;   // 是否为好友
  optional string        province        = 10;  // 省份
  optional string        signature       = 11;  // 签名
  optional bool          star            = 12;  // 是否为特别好友
  optional string        weixin          = 13;  // IM专属id，在企微环境中特指weixinId
  optional string        corporation     = 14;  // 企业
  optional string        title           = 15;  // 头衔
  optional string        description     = 16;  // 描述
  optional bool          coworker        = 17;  // 是否为同事
  repeated string        phones          = 18;  // 电话号码，企微中最多5个
  optional string        additional_info = 19;  // 额外信息，是由JS对象stringify得到的字符串，目前支持的内容包含addContactTime、corpId等。
  repeated string        tag_ids         = 20;  // 标签（的id）

  /**
   *  The protobuf encoding doesn't distinguish between these two cases. (undefined vs [])
   *  Since protobuf is language-agnostic,
   *  it doesn't understand the conceptual nuance of "undefined" versus "[]" of Javascript.
   */
  optional bool          clear_phones    = 21;
  optional bool          clear_tag_ids   = 22;
}

message ContactPayloadModifyResponse {}
