// Code generated by mdatagen. DO NOT EDIT.

package metadata

import (
	"go.opentelemetry.io/collector/confmap"
	"go.opentelemetry.io/collector/filter"
)

// MetricConfig provides common config for a particular metric.
type MetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool
}

func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error {
	if parser == nil {
		return nil
	}

	err := parser.Unmarshal(ms)
	if err != nil {
		return err
	}

	ms.enabledSetByUser = parser.IsSet("enabled")
	return nil
}

// MetricsConfig provides config for sampleentity metrics.
type MetricsConfig struct {
	K8sPodCPUTime        MetricConfig `mapstructure:"k8s.pod.cpu_time"`
	K8sPodPhase          MetricConfig `mapstructure:"k8s.pod.phase"`
	K8sReplicasetDesired MetricConfig `mapstructure:"k8s.replicaset.desired"`
}

func DefaultMetricsConfig() MetricsConfig {
	return MetricsConfig{
		K8sPodCPUTime: MetricConfig{
			Enabled: true,
		},
		K8sPodPhase: MetricConfig{
			Enabled: true,
		},
		K8sReplicasetDesired: MetricConfig{
			Enabled: true,
		},
	}
}

// ResourceAttributeConfig provides common config for a particular resource attribute.
type ResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// Experimental: MetricsInclude defines a list of filters for attribute values.
	// If the list is not empty, only metrics with matching resource attribute values will be emitted.
	MetricsInclude []filter.Config `mapstructure:"metrics_include"`
	// Experimental: MetricsExclude defines a list of filters for attribute values.
	// If the list is not empty, metrics with matching resource attribute values will not be emitted.
	// MetricsInclude has higher priority than MetricsExclude.
	MetricsExclude []filter.Config `mapstructure:"metrics_exclude"`

	enabledSetByUser bool
}

func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error {
	if parser == nil {
		return nil
	}
	err := parser.Unmarshal(rac)
	if err != nil {
		return err
	}
	rac.enabledSetByUser = parser.IsSet("enabled")
	return nil
}

// ResourceAttributesConfig provides config for sampleentity resource attributes.
type ResourceAttributesConfig struct {
	K8sNamespaceName  ResourceAttributeConfig `mapstructure:"k8s.namespace.name"`
	K8sPodName        ResourceAttributeConfig `mapstructure:"k8s.pod.name"`
	K8sPodUID         ResourceAttributeConfig `mapstructure:"k8s.pod.uid"`
	K8sReplicasetName ResourceAttributeConfig `mapstructure:"k8s.replicaset.name"`
	K8sReplicasetUID  ResourceAttributeConfig `mapstructure:"k8s.replicaset.uid"`
}

func DefaultResourceAttributesConfig() ResourceAttributesConfig {
	return ResourceAttributesConfig{
		K8sNamespaceName: ResourceAttributeConfig{
			Enabled: true,
		},
		K8sPodName: ResourceAttributeConfig{
			Enabled: true,
		},
		K8sPodUID: ResourceAttributeConfig{
			Enabled: true,
		},
		K8sReplicasetName: ResourceAttributeConfig{
			Enabled: true,
		},
		K8sReplicasetUID: ResourceAttributeConfig{
			Enabled: true,
		},
	}
}

// MetricsBuilderConfig is a configuration for sampleentity metrics builder.
type MetricsBuilderConfig struct {
	Metrics            MetricsConfig            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

func DefaultMetricsBuilderConfig() MetricsBuilderConfig {
	return MetricsBuilderConfig{
		Metrics:            DefaultMetricsConfig(),
		ResourceAttributes: DefaultResourceAttributesConfig(),
	}
}
