syntax = "proto3";
package band.bandtss.v1beta1;

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";

import "band/bandtss/v1beta1/genesis.proto";

option go_package = "github.com/bandprotocol/chain/v3/x/bandtss/types";

// Msg defines the bandtss Msg service.
service Msg {
  option (cosmos.msg.v1.service) = true;
  // RequestSignature submits a general message to be signed by a specific group.
  rpc RequestSignature(MsgRequestSignature) returns (MsgRequestSignatureResponse);

  // Activate activates the status of the sender.
  rpc Activate(MsgActivate) returns (MsgActivateResponse);

  // UpdateParams updates the x/bandtss parameters.
  rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);

  // TransitionGroup creates a request for creating a new group and replacing current group.
  rpc TransitionGroup(MsgTransitionGroup) returns (MsgTransitionGroupResponse);

  // ForceTransitionGroup sets the given group to the incoming group without the signature of a transition
  // message from a current group.
  rpc ForceTransitionGroup(MsgForceTransitionGroup) returns (MsgForceTransitionGroupResponse);
}

// MsgRequestSignature is a request message used for initiating the signing process.
message MsgRequestSignature {
  option (cosmos.msg.v1.signer)      = "sender";
  option (amino.name)                = "bandtss/MsgRequestSignature";
  option (gogoproto.goproto_getters) = false;

  // content is the signature order of this request signature message.
  google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"];
  // memo is the additional note of the message.
  string memo = 2;
  // fee_limit is the maximum tokens that will be paid for this request.
  repeated cosmos.base.v1beta1.Coin fee_limit = 3
      [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
  // sender is the requester of the signing process.
  string sender = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgRequestSignatureResponse is response data for MsgRequestSignature message
message MsgRequestSignatureResponse {}

// MsgActivate is a message used to activate the status of the sender.
message MsgActivate {
  option (cosmos.msg.v1.signer) = "sender";
  option (amino.name)           = "bandtss/MsgActivate";

  // address is the signer of this message, who must be a member of the group.
  string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // group_id is the group id of the member.
  uint64 group_id = 2
      [(gogoproto.customname) = "GroupID", (gogoproto.casttype) = "github.com/bandprotocol/chain/v3/pkg/tss.GroupID"];
}

// MsgActivateResponse is response data for MsgActivate message
message MsgActivateResponse {}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
  option (cosmos.msg.v1.signer) = "authority";
  option (amino.name)           = "bandtss/MsgUpdateParams";

  // params defines the x/tss parameters to update.
  Params params = 1 [(gogoproto.nullable) = false];
  // authority is the address that controls the module (defaults to x/gov unless overwritten).
  string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message.
message MsgUpdateParamsResponse {}

// MsgTransitionGroup is the Msg/TransitionGroup request type.
message MsgTransitionGroup {
  option (cosmos.msg.v1.signer) = "authority";
  option (amino.name)           = "bandtss/MsgTransitionGroup";

  // members is a list of members in this group.
  repeated string members = 1;
  // threshold is a minimum number of members required to produce a signature.
  uint64 threshold = 2;
  // exec_time is the time that will be substituted in place of the group.
  google.protobuf.Timestamp exec_time = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
  // authority is the address that controls the module (defaults to x/gov unless overwritten).
  string authority = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgTransitionGroupResponse is the Msg/TransitionGroup response type.
message MsgTransitionGroupResponse {}

// MsgForceTransitionGroup is the Msg/ForceTransitionGroup request type.
message MsgForceTransitionGroup {
  option (cosmos.msg.v1.signer) = "authority";
  option (amino.name)           = "bandtss/ForceTransitionGroup";

  // incoming_group_id is the ID of the group that the module want to transition to.
  uint64 incoming_group_id = 1 [
    (gogoproto.customname) = "IncomingGroupID",
    (gogoproto.casttype)   = "github.com/bandprotocol/chain/v3/pkg/tss.GroupID"
  ];
  // exec_time is the time that will be substituted in place of the group.
  google.protobuf.Timestamp exec_time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
  // authority is the address that controls the module (defaults to x/gov unless overwritten).
  string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgForceTransitionGroupResponse is the Msg/ForceTransitionGroup response type.
message MsgForceTransitionGroupResponse {}
