syntax = "proto3";
package cosmos.quarantine.v1beta1;

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos/quarantine/v1beta1/quarantine.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/provenance-io/provenance/x/quarantine";

service Msg {
  option (cosmos.msg.v1.service) = true;
  option deprecated              = true;

  // Deprecated: The quarantine module has been removed.
  rpc OptIn(MsgOptIn) returns (MsgOptInResponse) {
    option deprecated = true;
  }

  // Deprecated: The quarantine module has been removed.
  rpc OptOut(MsgOptOut) returns (MsgOptOutResponse) {
    option deprecated = true;
  }

  // Deprecated: The quarantine module has been removed.
  rpc Accept(MsgAccept) returns (MsgAcceptResponse) {
    option deprecated = true;
  }

  // Deprecated: The quarantine module has been removed.
  rpc Decline(MsgDecline) returns (MsgDeclineResponse) {
    option deprecated = true;
  }

  // Deprecated: The quarantine module has been removed.
  rpc UpdateAutoResponses(MsgUpdateAutoResponses) returns (MsgUpdateAutoResponsesResponse) {
    option deprecated = true;
  }
}

// MsgOptIn represents a message for opting in to account quarantine.
message MsgOptIn {
  option (cosmos.msg.v1.signer) = "to_address";

  string to_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgOptInResponse defines the Msg/OptIn response type.
message MsgOptInResponse {}

// MsgOptOut represents a message for opting in to account quarantine.
message MsgOptOut {
  option (cosmos.msg.v1.signer) = "to_address";

  string to_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgOptOutResponse defines the Msg/OptOut response type.
message MsgOptOutResponse {}

// MsgAccept represents a message for accepting quarantined funds.
message MsgAccept {
  option (cosmos.msg.v1.signer) = "to_address";

  // to_address is the address of the quarantined account that is accepting funds.
  string to_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // from_addresses is one or more addresses that have sent funds to the quarantined account.
  // All funds quarantined for to_address from any from_addresses are marked as accepted and released if appropriate.
  // At least one is required.
  repeated string from_addresses = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // permanent, if true, sets up auto-accept for the to_address from each from_address.
  // If false (default), only the currently quarantined funds will be accepted.
  bool permanent = 3;
}

// MsgAcceptResponse defines the Msg/Accept response type.
message MsgAcceptResponse {
  // funds_released is the amount that was quarantined but has now been released and sent to the requester.
  repeated cosmos.base.v1beta1.Coin funds_released = 1 [
    (gogoproto.nullable)     = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
    (amino.dont_omitempty)   = true,
    (amino.encoding)         = "legacy_coins"
  ];
}

// MsgDecline represents a message for declining quarantined funds.
message MsgDecline {
  option (cosmos.msg.v1.signer) = "to_address";

  // to_address is the address of the quarantined account that is accepting funds.
  string to_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // from_addresses is one or more addresses that have sent funds to the quarantined account.
  // All funds quarantined for to_address from any from_addresses are marked as declined.
  // At least one is required.
  repeated string from_addresses = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // permanent, if true, sets up auto-decline for the to_address from each from_address.
  // If false (default), only the currently quarantined funds will be declined.
  bool permanent = 3;
}

// MsgDeclineResponse defines the Msg/Decline response type.
message MsgDeclineResponse {}

// MsgUpdateAutoResponses represents a message for updating quarantine auto-responses for a receiving address.
message MsgUpdateAutoResponses {
  option (cosmos.msg.v1.signer) = "to_address";

  // to_address is the quarantined address that would be accepting or declining funds.
  string to_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // updates is the list of addresses and auto-responses that should be updated for the to_address.
  repeated AutoResponseUpdate updates = 2;
}

// MsgUpdateAutoResponsesResponse defines the Msg/UpdateAutoResponse response type.
message MsgUpdateAutoResponsesResponse {}
