package model

import (
	"github.com/tech/sendico/pkg/discovery"
	"testing"
)

func TestParseRail(t *testing.T) {
	cases := []struct {
		name  string
		input string
		want  Rail
	}{
		{name: "crypto", input: "crypto", want: discovery.RailCrypto},
		{name: "settlement canonical", input: "SETTLEMENT", want: discovery.RailProviderSettlement},
		{name: "settlement legacy", input: "provider_settlement", want: discovery.RailProviderSettlement},
		{name: "card canonical", input: "card", want: discovery.RailCardPayout},
		{name: "card legacy", input: "card_payout", want: discovery.RailCardPayout},
		{name: "onramp", input: "fiat_onramp", want: discovery.RailFiatOnRamp},
		{name: "offramp", input: "fiat_offramp", want: discovery.RailFiatOffRamp},
		{name: "unknown", input: "telegram", want: discovery.RailUnspecified},
	}

	for _, tc := range cases {
		t.Run(tc.name, func(t *testing.T) {
			if got := ParseRail(tc.input); got != tc.want {
				t.Fatalf("ParseRail(%q) = %q, want %q", tc.input, got, tc.want)
			}
		})
	}
}
