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";

message ContactExternalUserIdPair {
  string contact_id = 1;
  string external_user_id = 2;
}

message RoomAntiSpamStrategy {
  string id = 1;
  string name = 2;
}

message GetContactExternalUserIdRequest {
  repeated string contact_ids = 1;
  string service_provider_id = 2;
}

message GetContactExternalUserIdResponse {
  repeated ContactExternalUserIdPair contact_external_user_id_pairs = 1;
}

message GetRoomAntiSpamStrategyListRequest {}

message GetRoomAntiSpamStrategyListResponse {
  repeated RoomAntiSpamStrategy strategies = 1;
}

message GetRoomAntiSpamStrategyEffectRoomListRequest {
  string strategy_id = 1;
}

message GetRoomAntiSpamStrategyEffectRoomListResponse {
  repeated string room_ids = 1;
}

message ApplyRoomAntiSpamStrategyRequest {
  string strategy_id = 1;
  repeated string room_ids = 2;
  bool active = 3;
}

message ApplyRoomAntiSpamStrategyResponse {}

enum CorpMessageInterceptionType {
  Interception_Type_Hard = 0;
  Interception_Type_Soft = 1;
}

message CorpMessageInterceptionStrategy {
  string name = 1;
  repeated string words = 2;
  bool phone_number = 3;
  bool email = 4;
  bool red_packet = 5;
  CorpMessageInterceptionType type = 6;
}

message GetCorpMessageInterceptionStrategiesRequest {}

message GetCorpMessageInterceptionStrategiesResponse {
  repeated CorpMessageInterceptionStrategy strategies = 1;
}

enum OrgBroadcastTargetStatus {
  ORG_BROADCAST_TARGET_STATUS_UNSENT      = 0;
  ORG_BROADCAST_TARGET_STATUS_SENT        = 1;
  ORG_BROADCAST_TARGET_STATUS_NOT_FRIEND  = 2;
  ORG_BROADCAST_TARGET_STATUS_OCCUPIED    = 3;
  ORG_BROADCAST_TARGET_STATUS_UNCONFIRMED = 4;
  ORG_BROADCAST_TARGET_STATUS_CONFIRMED   = 5;
  ORG_BROADCAST_TARGET_STATUS_EXPIRED     = 6;
  ORG_BROADCAST_TARGET_STATUS_CANCELED    = 7;
  ORG_BROADCAST_TARGET_STATUS_NEW_UNSENT  = 8;
}

message OrgBroadcastTarget {
  string contact_id = 1;  // set when conversation_type is person
  string room_id = 2;     // set when conversation_type is group
  OrgBroadcastTargetStatus status = 3;
}

message OrgBroadcastPayloadRequest {
  string id = 1;
}

message OrgBroadcastPayloadResponse {
  string id = 1;
  int32 send_type = 2;          // 0: official (org admin), 1: personal, 2: special
  int32 conversation_type = 3;  // 0: person, 1: group
  string creator_id = 4;
  int64 exec_time = 5;          // milliseconds timestamp of the scheduled sending, 0 means immediately
  int32 status = 6;             // 0: checking, 1: check succeeded, 2: check failed, 3: delayed send succeeded, 4: delayed send canceled
  bool can_cancel = 7;
  bool allow_select = 8;        // members may adjust targets before sending
  bool sent = 9;
  int32 total_count = 10;
  int32 sent_count = 11;
  string content_list_json = 12;
  repeated OrgBroadcastTarget targets = 13;
}

message OrgBroadcastExecuteRequest {
  string id = 1;
  // empty means all targets of the plan; otherwise a subset of the plan targets.
  // clients must not send an explicit empty selection, it would be read as all targets
  repeated string target_ids = 2;
}

message OrgBroadcastExecuteResponse {}
