package consts

import "time"

const (
	ProviderTypeAWS = "aws"
	ProviderTypeGCP = "gcp"
	ProviderTypeEKS = "eks"
	ProviderTypeGKE = "gke"

	ProviderTypeAWSFreeTier   = "aws-free-tier"
	ProviderTypeAWSSharedTier = "aws-shared-tier"
	ProviderTypeGCPSharedTier = "gcp-shared-tier"

	AMD64ArchName = "amd64"
	ARM64ArchName = "arm64"

	ClusterPrefix = "db"
	// AnnGracefulShutdownTiDB is pod annotation key to indicate the pod will be processed by graceful shutdown tidb webhook
	AnnGracefulShutdownTiDB = "pingcap.com/graceful-shutdown-tidb"
	// AnnDeletePodWaitTimeout is pod annotation key to indicate the wait timeout for deleting pod
	AnnDeletePodWaitTimeout = "pingcap.com/delete-pod-wait-timeout"
	// AnnHealthCheckPort is service annotation key to indicate customized LB health check port
	AnnHealthCheckPort = "pingcap.com/health-check-port"
	// HealthCheckerContainerName is the name of tidb pod health checker sidecar
	HealthCheckerContainerName = "health-checker"

	AnnSysctlInit    = "tidb.pingcap.com/sysctl-init"
	AnnSysctlInitVal = "true"

	// for billing system
	BillingTiDBConfig = "billing-tidb-config"

	AWS_ACCESS_KEY_ENV_VAR string = "AWS_ACCESS_KEY_ID"
	AWS_SECRET_KEY_ENV_VAR string = "AWS_SECRET_ACCESS_KEY" // #nosec G101

	ClusterNameLabelKey         = "cluster.cloud.pingcap.com/name"
	ClusterNamespaceLabelKey    = "cluster.cloud.pingcap.com/namespace"
	ClusterTicdcLabelKey        = "cluster.cloud.pingcap.com/cdcname"
	ClusterNetworkLabelKey      = "cluster.cloud.pingcap.com/networkname"
	UpstreamClusterNameLabelKey = "cluster.cloud.pingcap.com/upstreamcluster"

	MetricInterfaceEndpointNameAnnotationKey = "o11y.cloud.pingcap.com/metric-interface-endpoint-name"
	S3GatewayEndpointNameAnnotationKey       = "o11y.cloud.pingcap.com/s3-gateway-endpoint-name"
	O11yIDAnnotationKey                      = "o11y.cloud.pingcap.com/id"
	O11yVersionAnnotationKey                 = "o11y.cloud.pingcap.com/version"
	O11yClusterEndpointAnnotationKeyPrefix   = "o11y.cloud.pingcap.com/endpoint-name"

	// BRGCPSecretName is the secret name used to store GCP Application Default Credentials for Backup and Restore.
	BRGCPSecretName string = "gcp-br-credentials" // #nosec G101

	// LocalOperatorNamespace is the namespace in which the tidb-operator will be installed.
	LocalOperatorNamespace = "tidb-admin"

	// AnnOperationReconciled used to make object get reconciled
	AnnOperationReconciled = "cloud.pingcap.com/operation-reconcile"

	ClusterTagKey = "tags.tidbcloud.com/cluster"
	TenantTagKey  = "tags.tidbcloud.com/tenant"
	ProjectTagKey = "tags.tidbcloud.com/project"

	ServiceName       = "Infra-API"
	LightstepEndpoint = "ingest.lightstep.com:443"

	CertificateOrg        = "PingCAP"
	CertManagerGroup      = "awspca.cert-manager.io"
	AwsPcaIssuer          = "aws-pca-issuer"
	AwsPcaIssuerKind      = "AWSPCAClusterIssuer"
	CaCertificateDuration = 20 * 365 * 24 * time.Hour // 20 years
	CertificateDuration   = 10 * 365 * 24 * time.Hour // 10 years
	RenewBefore           = 30 * 24 * time.Hour       // 30 days
)

func O11yClusterEndpointAnnotationKey(clusterName string) string {
	return O11yClusterEndpointAnnotationKeyPrefix + "-" + clusterName
}
