syntax = "proto3";
package band.tunnel.v1beta1;

import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";

import "band/feeds/v1beta1/encoder.proto";
import "band/feeds/v1beta1/feeds.proto";

option go_package            = "github.com/bandprotocol/chain/v3/x/tunnel/types";
option (gogoproto.equal_all) = true;

// TSSRoute represents a route for tss packets and implements the RouteI interface.
message TSSRoute {
  option (cosmos_proto.implements_interface) = "RouteI";

  // destination_chain_id is the destination chain ID
  string destination_chain_id = 1 [(gogoproto.customname) = "DestinationChainID"];
  // destination_contract_address is the destination contract address
  string destination_contract_address = 2;
  // encoder is the mode of encoding packet data.
  band.feeds.v1beta1.Encoder encoder = 3;
}

// TSSPacketReceipt represents a receipt for a tss packet and implements the PacketReceiptI interface.
message TSSPacketReceipt {
  option (cosmos_proto.implements_interface) = "PacketReceiptI";

  // signing_id is the signing ID
  uint64 signing_id = 1 [
    (gogoproto.customname) = "SigningID",
    (gogoproto.casttype)   = "github.com/bandprotocol/chain/v3/x/bandtss/types.SigningID"
  ];
}

// IBCRoute represents a route for IBC packets and implements the RouteI interface.
message IBCRoute {
  option (cosmos_proto.implements_interface) = "RouteI";

  // channel_id is the IBC channel ID
  string channel_id = 1 [(gogoproto.customname) = "ChannelID"];
}

// IBCPacketReceipt represents a receipt for a IBC packet and implements the PacketReceiptI interface.
message IBCPacketReceipt {
  option (cosmos_proto.implements_interface) = "PacketReceiptI";

  // sequence is representing the sequence of the IBC packet.
  uint64 sequence = 1;
}

// TunnelPricesPacketData represents the IBC packet payload for the tunnel packet.
message TunnelPricesPacketData {
  // tunnel_id is the tunnel ID
  uint64 tunnel_id = 1 [(gogoproto.customname) = "TunnelID"];
  // sequence is representing the sequence of the tunnel packet.
  uint64 sequence = 2;
  // prices is the list of prices information from feeds module.
  repeated band.feeds.v1beta1.Price prices = 3 [(gogoproto.nullable) = false];
  // created_at is the timestamp when the packet is created
  int64 created_at = 4;
}

// IBCHookRoute is the type for an IBC hook route
message IBCHookRoute {
  option (cosmos_proto.implements_interface) = "RouteI";

  // channel_id is the IBC channel ID
  string channel_id = 1 [(gogoproto.customname) = "ChannelID"];
  // destination_contract_address is the destination contract address
  string destination_contract_address = 2;
}

// IBCHookPacketReceipt represents a receipt for a IBC hook packet and implements the PacketReceiptI interface.
message IBCHookPacketReceipt {
  option (cosmos_proto.implements_interface) = "PacketContentI";

  // sequence is representing the sequence of the IBC packet.
  uint64 sequence = 1;
}

// IBCHookMemo is the type for a data packet that will be stringtify to be a memo of IBC hook packet
message IBCHookMemo {
  // Payload defines target contract and detail of function call (msg).
  message Payload {
    // Msg defines function name (`receive_packet`) and a type of function arguments.
    message Msg {
      // ReceivePacket represents the arguments of `receive_packet` function
      message ReceivePacket {
        // packet represents the data packet
        TunnelPricesPacketData packet = 1 [(gogoproto.nullable) = false];
      }
      // receive_packet is the function name on the destination contract
      ReceivePacket receive_packet = 1 [(gogoproto.nullable) = false];
    }
    // contract is destination contract address
    string contract = 1;
    // msg is the ibc hook message
    Msg msg = 2 [(gogoproto.nullable) = false];
  }
  // wasm is the payload for calling destination contract
  Payload wasm = 1 [(gogoproto.nullable) = false];
}

// RouterRoute is the type for a Router route
message RouterRoute {
  option (cosmos_proto.implements_interface) = "RouteI";

  // destination_chain_id is the destination chain ID
  string destination_chain_id = 1 [(gogoproto.customname) = "DestinationChainID"];
  // destination_contract_address is the destination contract address
  string destination_contract_address = 2;
  // destination_gas_limit is the destination gas limit
  uint64 destination_gas_limit = 3;
}

// RouterPacketReceipt represents a receipt for a Router packet and implements the PacketReceiptI interface.
message RouterPacketReceipt {
  option (cosmos_proto.implements_interface) = "PacketReceiptI";

  // sequence is representing the sequence of the IBC packet.
  uint64 sequence = 1;
}

// RouterMemo is the type for a data packet that will be stringtify to be a memo of IBC packet
message RouterMemo {
  // Payload defines target contract and detail of function call (msg).
  message Payload {
    // Msg defines function name (`receive_band_data`) and a type of function arguments.
    message Msg {
      // ReceiveBandDataArgs represents the arguments of `receive_band_data` function
      message ReceiveBandDataArgs {
        // dest_chain_id is the destination chain ID
        string dest_chain_id = 1 [(gogoproto.customname) = "DestChainID"];
        // dest_contract_address is the destination contract address
        string dest_contract_address = 2;
        // gas_limit is the destination gas limit
        uint64 gas_limit = 3;
        // payload is the payload of the packet
        string payload = 4;
      }
      // receive_band_data is the function name on the destination contract
      ReceiveBandDataArgs receive_band_data = 1 [(gogoproto.nullable) = false];
    }
    // contract is destination contract address
    string contract = 1;
    // msg is the Router message
    Msg msg = 2 [(gogoproto.nullable) = false];
  }
  // wasm is the payload for calling destination contract
  Payload wasm = 1 [(gogoproto.nullable) = false];
}

// AxelarRoute represents a route for Axelar packets and implements the RouteI interface.
message AxelarRoute {
  option (cosmos_proto.implements_interface) = "RouteI";

  // destination_chain_id is the destination chain ID
  string destination_chain_id = 1 [(gogoproto.customname) = "DestinationChainID", (gogoproto.casttype) = "ChainName"];
  // destination_contract_address is the destination contract address
  string destination_contract_address = 2;
  // fee is the fee for each packet in the Axelar network.
  cosmos.base.v1beta1.Coin fee = 3 [(gogoproto.nullable) = false];
}

// AxelarPacketReceipt represents a receipt for a Axelar packet and implements the PacketReceiptI interface.
message AxelarPacketReceipt {
  option (cosmos_proto.implements_interface) = "PacketReceiptI";

  // sequence is representing the sequence of the Axelar packet.
  uint64 sequence = 1;
}
