package clusteragent

import (
	"strings"

	cloudv1 "github.com/tidbcloud/infra-api/api/v1"
	apicommon "github.com/tidbcloud/infra-provider/api/tidbcloud/common"
)

func ConvertComponentTypeToAPI(tp cloudv1.ComponentType) apicommon.ComponentType {
	return apicommon.ComponentType(apicommon.ComponentType_value[strings.ToUpper(string(tp))])
}

func ConvertComponentTypeFromAPI(tp apicommon.ComponentType) cloudv1.ComponentType {
	return cloudv1.ComponentType(strings.ToLower(tp.String()))
}
