package premium

import (
	pb "github.com/tidbcloud/config-center/proto/config_center"
	"github.com/tidbcloud/config-center/templategen"
)

// TiProxyVersion is the component version tiproxy templates and default versions
// are pinned to, independent of the cluster version.
const TiProxyVersion = "v1.4.0"

// specTiProxy drives the default for both SHARED_POOL and LOGICAL_CLUSTER, both
// pinned to TiProxyVersion regardless of the cluster version.
var specTiProxy = templategen.Spec{
	ConfigType: pb.SHARED_POOL_CONFIG_TIPROXY,
	Name:       "system template of premium tiproxy",
	Bindings: []templategen.Binding{
		{ClusterType: pb.ClusterType_SHARED_POOL, ConfigType: pb.SHARED_POOL_CONFIG_TIPROXY},
		{ClusterType: pb.ClusterType_LOGICAL_CLUSTER, ConfigType: pb.LOGICAL_CLUSTER_CONFIG_TIPROXY},
	},
	Base: templategen.MustTOML(`
[balance]
label-name = "keyspace"
policy = "connection"

[proxy]
graceful-wait-before-shutdown = 15
proxy-protocol = "v2"

[api]
proxy-protocol = "v2"

[security]
[security.server-tls]
skip-ca = true
`),
}
