syntax = "proto3";
package neutron.cron;

import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v7/x/cron/types";

// Defines when messages will be executed in the block
enum ExecutionStage {
  // Execution at the end of the block
  EXECUTION_STAGE_END_BLOCKER = 0;
  // Execution at the beginning of the block
  EXECUTION_STAGE_BEGIN_BLOCKER = 1;
}

// Defines the schedule for execution
message Schedule {
  // Name of schedule
  string name = 1;
  // Period in blocks
  uint64 period = 2;
  // Msgs that will be executed every certain number of blocks, specified in the `period` field
  repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false];
  // Last execution's block height
  uint64 last_execute_height = 4;
  // Stage when messages will be executed
  ExecutionStage execution_stage = 5;
}

// Defines the contract and the message to pass
message MsgExecuteContract {
  // The address of the smart contract
  string contract = 1;
  // JSON encoded message to be passed to the contract
  string msg = 2;
}

// Defines the number of current schedules
message ScheduleCount {
  // The number of current schedules
  int32 count = 1;
}
