package grpc

import (
	"testing"

	hostservice "hyapp/services/user-service/internal/service/host"
	userservice "hyapp/services/user-service/internal/service/user"
)

func TestCapabilityForBusinessLookupSceneUsesExactManagerCapability(t *testing.T) {
	for _, item := range []struct {
		scene      string
		capability string
	}{
		{scene: userservice.BusinessSceneManagerResourceGrant, capability: hostservice.CapabilityManagerResourceGrant},
		{scene: userservice.BusinessSceneManagerVIPGrant, capability: hostservice.CapabilityManagerGrantVIP},
		{scene: userservice.BusinessSceneManagerUpdateLevel, capability: hostservice.CapabilityManagerUpdateUserLevel},
		{scene: userservice.BusinessSceneManagerAddBDLeader, capability: hostservice.CapabilityManagerAddBDLeader},
		{scene: userservice.BusinessSceneManagerAddAdmin, capability: hostservice.CapabilityManagerAddAdmin},
		{scene: userservice.BusinessSceneManagerAddSuperadmin, capability: hostservice.CapabilityManagerAddSuperadmin},
		{scene: userservice.BusinessSceneManagerBlockUser, capability: hostservice.CapabilityManagerBlockUser},
		{scene: userservice.BusinessSceneManagerTransfer, capability: hostservice.CapabilityManagerTransferCountry},
	} {
		capability, ok := capabilityForBusinessLookupScene(item.scene)
		if !ok || capability != item.capability {
			t.Fatalf("scene %q mapped to capability=%q ok=%v, want %q", item.scene, capability, ok, item.capability)
		}
	}
}
