package tron

import (
	"context"
	"testing"

	"github.com/stretchr/testify/require"
	"github.com/tech/sendico/gateway/tron/internal/service/gateway/driver"
	"github.com/tech/sendico/gateway/tron/shared"
	"github.com/tech/sendico/gateway/tron/storage/model"
	moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
	"go.uber.org/zap"
)

func TestEstimateFeeSelfTransferReturnsZero(t *testing.T) {
	logger := zap.NewNop()
	d := New(logger)
	wallet := &model.ManagedWallet{
		WalletRef:      "wallet_ref",
		DepositAddress: "TGBDXEg9rxSqGFJDcb889zqTjDwx1bmLRF",
	}
	network := shared.Network{
		Name:        "tron_mainnet",
		NativeToken: "TRX",
	}
	amount := &moneyv1.Money{Currency: "TRX", Amount: "1000000"}

	fee, err := d.EstimateFee(context.Background(), driver.Deps{}, network, wallet, wallet.DepositAddress, amount)
	require.NoError(t, err)
	require.NotNil(t, fee)
	require.Equal(t, "TRX", fee.GetCurrency())
	require.Equal(t, "0", fee.GetAmount())
}
