syntax = "proto3";
package provenance.trigger.v1;

import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";

option go_package          = "github.com/provenance-io/provenance/x/trigger/types";
option java_package        = "io.provenance.trigger.v1";
option java_multiple_files = true;

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

  // CreateTrigger is the RPC endpoint for creating a trigger
  rpc CreateTrigger(MsgCreateTriggerRequest) returns (MsgCreateTriggerResponse);
  // DestroyTrigger is the RPC endpoint for creating a trigger
  rpc DestroyTrigger(MsgDestroyTriggerRequest) returns (MsgDestroyTriggerResponse);
}

// MsgCreateTriggerRequest is the request type for creating a trigger RPC
message MsgCreateTriggerRequest {
  option (cosmos.msg.v1.signer) = "authorities";
  option (gogoproto.equal)      = true;

  // The signing authorities for the request
  repeated string authorities = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // The event that must be detected for the trigger to fire.
  google.protobuf.Any event = 2 [(cosmos_proto.accepts_interface) = "TriggerEventI"];
  // The messages to run when the trigger fires.
  repeated google.protobuf.Any actions = 3;
}

// MsgCreateTriggerResponse is the response type for creating a trigger RPC
message MsgCreateTriggerResponse {
  // trigger id that is generated on creation.
  uint64 id = 1;
}

// MsgDestroyTriggerRequest is the request type for creating a trigger RPC
message MsgDestroyTriggerRequest {
  option (cosmos.msg.v1.signer) = "authority";
  option (gogoproto.equal)      = true;

  // the id of the trigger to destroy.
  uint64 id = 1;
  // The signing authority for the request
  string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgDestroyTriggerResponse is the response type for creating a trigger RPC
message MsgDestroyTriggerResponse {}