package store

import "testing"

func TestValidateEffectivePricingRuleShape(t *testing.T) {
	tests := []struct {
		name       string
		resource   string
		unit       string
		calculator string
		valid      bool
	}{
		{name: "text", resource: "text_input", unit: "1k_tokens", calculator: "token_usage", valid: true},
		{name: "image", resource: "image", unit: "image", calculator: "unit_weight", valid: true},
		{name: "video", resource: "video", unit: "5s", calculator: "duration_weight", valid: true},
		{name: "video enhance", resource: "video_enhance", unit: "5s", calculator: "transition_matrix", valid: true},
		{name: "image vectorize", resource: "image_vectorize", unit: "conversion", calculator: "unit_weight", valid: true},
		{name: "wrong video unit", resource: "video", unit: "second", calculator: "duration_weight"},
		{name: "wrong image calculator", resource: "image", unit: "image", calculator: "token_usage"},
	}
	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			err := ValidateEffectivePricingRuleShape(test.resource, test.unit, test.calculator)
			if (err == nil) != test.valid {
				t.Fatalf("valid=%v err=%v", test.valid, err)
			}
		})
	}
}
