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 is added to a Cluster CR.
	MetricInterfaceEndpointNameAnnotationKey = "o11y.cloud.pingcap.com/metric-interface-endpoint-name"
	S3GatewayEndpointNameAnnotationKey       = "o11y.cloud.pingcap.com/s3-gateway-endpoint-name"
	O11yClusterStatusAnnotationKey           = "o11y.cloud.pingcap.com/status"
	// O11yIDAnnotationKey is added to a Network CR, represents s3/gcs id in o11y infra.
	O11yIDAnnotationKey = "o11y.cloud.pingcap.com/id"
	// MetricsO11yIDAnnotationKey represents prometheus id in o11y infra.
	MetricsO11yIDAnnotationKey      = "o11y.cloud.pingcap.com/metrics-id"
	O11yServiceDNSNameAnnotationKey = "o11y.cloud.pingcap.com/service-dns-name"
	O11yVersionAnnotationKey        = "o11y.cloud.pingcap.com/version"
	// O11yClusterEndpointAnnotationKeyPrefix is the prefix of the annotation key for cluster endpoint,
	// which is added to a Network CR.
	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
	BRGCPSecretDataKey string = "credentials"

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

	LocalClusterProxyName = "dbaas-proxy"

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

	// DEPRECATED: use "github.com/tidbcloud/infra-provider/pkg/consts"
	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

	AWSVolumeTypeGP2        = "gp2"
	GCPVolumeTypePDStandard = "pd-standard"

	// UseSelfManagedNodegroupAnnotation ... copy from infra-provider/pkg/consts
	UseSelfManagedNodegroupAnnotation = "tidbcloud.com/use-self-managed-nodegroup"
)

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