package commongcp

import (
	"fmt"
	"strings"
)

const dedicatedNodePoolNamePrefix = "tidbcloud-"

// DedicatedNodePoolName returns the physical GCP NodePool name for a dedicated agent.
//
// GCP NodePool names are capped at 40 characters, so for non-default specs the
// "tidbcloud-" prefix is stripped before appending the spec suffix. The
// default spec keeps the base name unchanged.
func DedicatedNodePoolName(baseName, specName string) string {
	if specName == "" || specName == defaultSpecName {
		return baseName
	}
	return fmt.Sprintf("%s-%s", strings.TrimPrefix(baseName, dedicatedNodePoolNamePrefix), specName)
}
