package xplan

import (
	"slices"
	"testing"

	"github.com/tech/sendico/payments/storage/model"
	paymenttypes "github.com/tech/sendico/pkg/payments/types"
)

func assertStep(
	t *testing.T,
	step Step,
	code string,
	action model.RailOperation,
	rail model.Rail,
	visibility model.ReportVisibility,
) {
	t.Helper()
	if got, want := step.StepCode, code; got != want {
		t.Fatalf("step code mismatch: got=%q want=%q", got, want)
	}
	if got, want := step.Action, action; got != want {
		t.Fatalf("step action mismatch: got=%q want=%q", got, want)
	}
	if got, want := step.Rail, rail; got != want {
		t.Fatalf("step rail mismatch: got=%q want=%q", got, want)
	}
	if got, want := step.Visibility, visibility; got != want {
		t.Fatalf("step visibility mismatch: got=%q want=%q", got, want)
	}
}

func testIntent(kind model.PaymentKind) model.PaymentIntent {
	return model.PaymentIntent{
		Kind: kind,
		Amount: &paymenttypes.Money{
			Amount:   "10",
			Currency: "USD",
		},
	}
}

func railPtr(v model.Rail) *model.Rail {
	return &v
}

func equalStringSlice(a, b []string) bool {
	return slices.Equal(a, b)
}
