syntax = "proto3";
package macaroon.v1;

import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "macaroon/v1/genesis.proto";

option go_package = "github.com/onsonr/sonr/x/macaroon/types";

// Msg defines the Msg service.
service Msg {
  option (cosmos.msg.v1.service) = true;

  // UpdateParams defines a governance operation for updating the parameters.
  //
  // Since: cosmos-sdk 0.47
  rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);

  // IssueMacaroon asserts the given controller is the owner of the given
  // address.
  rpc IssueMacaroon(MsgIssueMacaroon) returns (MsgIssueMacaroonResponse);
}

// MsgUpdateParams is the Msg/UpdateParams request type.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParams {
  option (cosmos.msg.v1.signer) = "authority";

  // authority is the address of the governance account.
  string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

  // params defines the parameters to update.
  //
  // NOTE: All parameters must be supplied.
  Params params = 2 [ (gogoproto.nullable) = false ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}

// MsgIssueMacaroon is the message type for the IssueMacaroon RPC.
message MsgIssueMacaroon {
  option (cosmos.msg.v1.signer) = "controller";

  // Controller is the address of the controller to authenticate.
  string controller = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

  // Origin is the origin of the request in wildcard form.
  string origin = 2;

  // Permissions is the scope of the service.
  map<string, string> permissions = 3;

  // token is the macron token to authenticate the operation.
  string token = 4;
}

// MsgIssueMacaroonResponse is the response type for the IssueMacaroon
// RPC.
message MsgIssueMacaroonResponse {
  bool success = 1;
  string token = 2;
}
