package config

type GlobalConfig struct {
	ServerConfig                   ServerConfig       `mapstructure:"server"`
	DataplaneConfig                []DataplaneCluster `mapstructure:"dataplane"`
	PrometheusIntegrationNamespace string             `mapstructure:"prometheusIntegrationNamespace" default:"prometheus-integration"`
}

type ServerConfig struct {
	FeatureGates map[FeatureGateName]FeatureGate `mapstructure:"featureGates"`
}

// FeatureGate ... https://pingcap.feishu.cn/docx/Nj1gdJxBnoWiO2xIHCdcWN7unqf
type FeatureGate struct {
	// If `All` is true, this feature gate will be enabled for all except DisabledTenants and DisabledProjects.
	// If `All` is false, this feature gate will be disabled for all except EnabledTenants and EnabledProjects.
	All bool `mapstructure:"all" default:"false"`
	// Enable the feature for the specified tenants.
	EnabledTenants []uint64 `mapstructure:"enabledTenants"`
	// Enable the feature for the specified projects.
	EnabledProjects []uint64 `mapstructure:"enabledProjects"`
	EnabledRegions  []string `mapstructure:"enabledRegions"`

	// Disable the feature for the specified tenants.
	DisabledTenants []uint64 `mapstructure:"disabledTenants"`
	// Disable the feature for the specified projects.
	DisabledProjects []uint64 `mapstructure:"disabledProjects"`
	DisabledRegions  []string `mapstructure:"disabledRegions"`

	// Required the feature in these regions
	RequiredRegions []string `mapstructure:"requiredRegions"`

	// Required if the organization is created after the specified time.
	AffectOrgCreatedAfter string `mapstructure:"affectOrgCreatedAfter" default:"2099-01-01T00:00:00Z"`
}

// DataplaneConfig example:
//   - name: us-west-2
//     provider: aws
//     resource_id: arn:aws:eks:us-west-2:123456789012:cluster/o11y-us-west-2
//   - name: us-west1
//     provider: gke
//     resource_id: /projects/my-project/locations/us-west1/clusters/o11y-us-west1
//   - name: local
//     provider: local
//     resource_id: "/root/.kube/config"

type DataplaneCluster struct {
	Name       string `mapstructure:"name" yaml:"name"`
	Provider   string `mapstructure:"provider" yaml:"provider"`
	ResourceID string `mapstructure:"resource_id" yaml:"resource_id"`
}
