syntax = "proto3";

package dto;
option go_package = "generated/types";

import "google/protobuf/timestamp.proto";

message MempoolOutInternalMessage {
  bool ihr_disabled = 1;  	// ihr_disabled : Bool
  bool bounce = 2;  	// bounce : Bool
  bool bounced = 3;  	// bounced : Bool
  bytes src = 4;  	// src : MsgAddressInt
  bytes dest = 5;  	// dest : MsgAddressInt
  bytes value = 6;  	// value : CurrencyCollection
  bytes ihr_fee = 7;  	// ihr_fee : Grams
  bytes fwd_fee = 8;  	// fwd_fee : Grams
  uint64 created_lt = 9;  	// created_lt : uint64
  uint32 created_at = 10;  	// created_at : uint32
}

message MempoolOutExternalOutMessage {
  bytes src = 1;  	// src : MsgAddressInt
  bytes dest = 2;  	// dest : MsgAddressExt
  uint64 created_lt = 3;  	// created_lt : uint64
  uint32 created_at = 4;  	// created_at : uint32
}

message MempoolOutMessage {
  bytes hash = 1;
  oneof info {
    MempoolOutInternalMessage internal_message = 2;
    MempoolOutExternalOutMessage external_out_message = 3;
  }
  
  message Init {
    optional bytes code = 1;
    optional bytes data = 2;
  }

  optional Init init = 4;
  
  bytes body = 5;
}

// Represents a single external message in the mempool.
message MempoolExternalMessage {
  bytes hash = 1;
  int32 workchain_id = 2;
  bytes shard = 3;
  bytes data = 4;
  bytes std_smc_address = 5;
  uint64 gas_spent = 6;

  repeated bytes out_msgs = 7;
  repeated MempoolOutMessage parsed_out_msgs = 8;
}

// Represents a collection of messages in the mempool with emulation results.
message MempoolPacket {
  google.protobuf.Timestamp server_ts = 1; // Server timestamp when the messages were recorded.
  uint32 expiration_ns = 2;                // Expiration time in nanoseconds for the message.
  repeated MempoolExternalMessage external_messages = 3; // List of external messages.
}

// Represents an external message.
message ExternalMessage {
  bytes data = 1; // Encoded message data.
}

// Represents a bundle of messages to be processed together on the validator's side.
message ValidatorBundle {
  repeated ExternalMessage message = 1; // List of messages in the bundle.
  google.protobuf.Timestamp expiration_ns = 2; // Timestamp when the bundle should be expired and not included in any future blocks.
  string id = 3; // ID of the bundle.
}

// Represents a bundle of messages to be processed together on the engine side.
message Bundle {
  repeated ExternalMessage message = 1; // List of messages in the bundle.
  google.protobuf.Timestamp expiration_ns = 2; // Timestamp when the bundle should be expired and not included in any future blocks.
}
