package httpapi

import (
	"testing"

	"github.com/easyai/easyai-ai-gateway/apps/api/internal/store"
)

func TestPricingRuleSetRejectsImplicitZeroAndUnsupportedCalculator(t *testing.T) {
	base := store.PricingRuleSetInput{
		RuleSetKey: "test", Name: "test",
		Rules: []store.PricingRuleInput{{
			ResourceType: "image", Unit: "image", BasePrice: 0,
			Currency: "resource", CalculatorType: "unit_weight",
		}},
	}
	if validPricingRuleSetInput(base) {
		t.Fatal("implicit zero price must be rejected")
	}
	base.Rules[0].IsFree = true
	if !validPricingRuleSetInput(base) {
		t.Fatal("explicit free price should be accepted")
	}
	base.Rules[0].CalculatorType = "formula"
	if validPricingRuleSetInput(base) {
		t.Fatal("arbitrary formula calculator must be rejected")
	}
}
