package config

import "testing"

func TestPaddleCheckoutConfigured(t *testing.T) {
	cfg := Config{
		PaddleAPIKey:     "pdl_sdbx_apikey_123",
		PaddleWebhookKey: "pdl_ntf_123",
		PaddlePriceMatrix: map[string]map[string]string{
			"starter":  {"czk": "pri_starter_czk", "usd": "pri_starter_usd"},
			"pro":      {"czk": "pri_pro_czk", "usd": "pri_pro_usd"},
			"business": {"czk": "pri_business_czk", "usd": "pri_business_usd"},
		},
	}

	if !cfg.PaddleCheckoutConfigured("pro") {
		t.Fatal("expected pro checkout configured")
	}
}

func TestPaddleCheckoutConfiguredRequiresWebhook(t *testing.T) {
	cfg := Config{
		PaddleAPIKey: "pdl_sdbx_apikey_123",
		PaddlePriceMatrix: map[string]map[string]string{
			"pro": {"czk": "pri_pro_czk", "usd": "pri_pro_usd"},
		},
	}

	if cfg.PaddleCheckoutConfigured("pro") {
		t.Fatal("expected checkout disabled without webhook key")
	}
}
