// Code generated by mdatagen. DO NOT EDIT.

package metadata

import (
	"fmt"

	"go.opentelemetry.io/collector/confmap"
	"go.opentelemetry.io/collector/filter"
	"go.opentelemetry.io/collector/pdata/pcommon"
)

// DefaultMetricMetricAttributeKey specifies the key of an attribute for the default.metric metric.
type DefaultMetricMetricAttributeKey string

const (
	DefaultMetricMetricAttributeKeyStringAttr        DefaultMetricMetricAttributeKey = "string_attr"
	DefaultMetricMetricAttributeKeyOverriddenIntAttr DefaultMetricMetricAttributeKey = "state"
	DefaultMetricMetricAttributeKeyEnumAttr          DefaultMetricMetricAttributeKey = "enum_attr"
	DefaultMetricMetricAttributeKeySliceAttr         DefaultMetricMetricAttributeKey = "slice_attr"
	DefaultMetricMetricAttributeKeyMapAttr           DefaultMetricMetricAttributeKey = "map_attr"
)

// DefaultMetricMetricConfig provides config for the default.metric metric.
type DefaultMetricMetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool

	AggregationStrategy string                            `mapstructure:"aggregation_strategy"`
	EnabledAttributes   []DefaultMetricMetricAttributeKey `mapstructure:"attributes"`
}

func (ms *DefaultMetricMetricConfig) 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
}

func (ms *DefaultMetricMetricConfig) Validate() error {
	for _, val := range ms.EnabledAttributes {
		switch val {
		case DefaultMetricMetricAttributeKeyStringAttr, DefaultMetricMetricAttributeKeyOverriddenIntAttr, DefaultMetricMetricAttributeKeyEnumAttr, DefaultMetricMetricAttributeKeySliceAttr, DefaultMetricMetricAttributeKeyMapAttr:
		default:
			return fmt.Errorf("metric default.metric doesn't have an attribute %v, valid attributes: [string_attr, state, enum_attr, slice_attr, map_attr]", val)
		}
	}

	switch ms.AggregationStrategy {
	case AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax:
	default:
		return fmt.Errorf("invalid aggregation strategy %q, valid strategies: [%s, %s, %s, %s]", ms.AggregationStrategy, AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax)
	}

	return nil
}

// DefaultMetricToBeRemovedMetricConfig provides config for the default.metric.to_be_removed metric.
type DefaultMetricToBeRemovedMetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool
}

func (ms *DefaultMetricToBeRemovedMetricConfig) 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
}

// MetricInputTypeMetricAttributeKey specifies the key of an attribute for the metric.input_type metric.
type MetricInputTypeMetricAttributeKey string

const (
	MetricInputTypeMetricAttributeKeyStringAttr        MetricInputTypeMetricAttributeKey = "string_attr"
	MetricInputTypeMetricAttributeKeyOverriddenIntAttr MetricInputTypeMetricAttributeKey = "state"
	MetricInputTypeMetricAttributeKeyEnumAttr          MetricInputTypeMetricAttributeKey = "enum_attr"
	MetricInputTypeMetricAttributeKeySliceAttr         MetricInputTypeMetricAttributeKey = "slice_attr"
	MetricInputTypeMetricAttributeKeyMapAttr           MetricInputTypeMetricAttributeKey = "map_attr"
)

// MetricInputTypeMetricConfig provides config for the metric.input_type metric.
type MetricInputTypeMetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool

	AggregationStrategy string                              `mapstructure:"aggregation_strategy"`
	EnabledAttributes   []MetricInputTypeMetricAttributeKey `mapstructure:"attributes"`
}

func (ms *MetricInputTypeMetricConfig) 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
}

func (ms *MetricInputTypeMetricConfig) Validate() error {
	for _, val := range ms.EnabledAttributes {
		switch val {
		case MetricInputTypeMetricAttributeKeyStringAttr, MetricInputTypeMetricAttributeKeyOverriddenIntAttr, MetricInputTypeMetricAttributeKeyEnumAttr, MetricInputTypeMetricAttributeKeySliceAttr, MetricInputTypeMetricAttributeKeyMapAttr:
		default:
			return fmt.Errorf("metric metric.input_type doesn't have an attribute %v, valid attributes: [string_attr, state, enum_attr, slice_attr, map_attr]", val)
		}
	}

	switch ms.AggregationStrategy {
	case AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax:
	default:
		return fmt.Errorf("invalid aggregation strategy %q, valid strategies: [%s, %s, %s, %s]", ms.AggregationStrategy, AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax)
	}

	return nil
}

// OptionalMetricMetricAttributeKey specifies the key of an attribute for the optional.metric metric.
type OptionalMetricMetricAttributeKey string

const (
	OptionalMetricMetricAttributeKeyStringAttr   OptionalMetricMetricAttributeKey = "string_attr"
	OptionalMetricMetricAttributeKeyBooleanAttr  OptionalMetricMetricAttributeKey = "boolean_attr"
	OptionalMetricMetricAttributeKeyBooleanAttr2 OptionalMetricMetricAttributeKey = "boolean_attr2"
)

// OptionalMetricMetricConfig provides config for the optional.metric metric.
type OptionalMetricMetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool

	AggregationStrategy string                             `mapstructure:"aggregation_strategy"`
	EnabledAttributes   []OptionalMetricMetricAttributeKey `mapstructure:"attributes"`
}

func (ms *OptionalMetricMetricConfig) 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
}

func (ms *OptionalMetricMetricConfig) Validate() error {
	for _, val := range ms.EnabledAttributes {
		switch val {
		case OptionalMetricMetricAttributeKeyStringAttr, OptionalMetricMetricAttributeKeyBooleanAttr, OptionalMetricMetricAttributeKeyBooleanAttr2:
		default:
			return fmt.Errorf("metric optional.metric doesn't have an attribute %v, valid attributes: [string_attr, boolean_attr, boolean_attr2]", val)
		}
	}

	switch ms.AggregationStrategy {
	case AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax:
	default:
		return fmt.Errorf("invalid aggregation strategy %q, valid strategies: [%s, %s, %s, %s]", ms.AggregationStrategy, AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax)
	}

	return nil
}

// OptionalMetricEmptyUnitMetricAttributeKey specifies the key of an attribute for the optional.metric.empty_unit metric.
type OptionalMetricEmptyUnitMetricAttributeKey string

const (
	OptionalMetricEmptyUnitMetricAttributeKeyStringAttr  OptionalMetricEmptyUnitMetricAttributeKey = "string_attr"
	OptionalMetricEmptyUnitMetricAttributeKeyBooleanAttr OptionalMetricEmptyUnitMetricAttributeKey = "boolean_attr"
)

// OptionalMetricEmptyUnitMetricConfig provides config for the optional.metric.empty_unit metric.
type OptionalMetricEmptyUnitMetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool

	AggregationStrategy string                                      `mapstructure:"aggregation_strategy"`
	EnabledAttributes   []OptionalMetricEmptyUnitMetricAttributeKey `mapstructure:"attributes"`
}

func (ms *OptionalMetricEmptyUnitMetricConfig) 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
}

func (ms *OptionalMetricEmptyUnitMetricConfig) Validate() error {
	for _, val := range ms.EnabledAttributes {
		switch val {
		case OptionalMetricEmptyUnitMetricAttributeKeyStringAttr, OptionalMetricEmptyUnitMetricAttributeKeyBooleanAttr:
		default:
			return fmt.Errorf("metric optional.metric.empty_unit doesn't have an attribute %v, valid attributes: [string_attr, boolean_attr]", val)
		}
	}

	switch ms.AggregationStrategy {
	case AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax:
	default:
		return fmt.Errorf("invalid aggregation strategy %q, valid strategies: [%s, %s, %s, %s]", ms.AggregationStrategy, AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax)
	}

	return nil
}

// ReaggregateMetricMetricAttributeKey specifies the key of an attribute for the reaggregate.metric metric.
type ReaggregateMetricMetricAttributeKey string

const (
	ReaggregateMetricMetricAttributeKeyStringAttr  ReaggregateMetricMetricAttributeKey = "string_attr"
	ReaggregateMetricMetricAttributeKeyBooleanAttr ReaggregateMetricMetricAttributeKey = "boolean_attr"
)

// ReaggregateMetricMetricConfig provides config for the reaggregate.metric metric.
type ReaggregateMetricMetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool

	AggregationStrategy string                                `mapstructure:"aggregation_strategy"`
	EnabledAttributes   []ReaggregateMetricMetricAttributeKey `mapstructure:"attributes"`
}

func (ms *ReaggregateMetricMetricConfig) 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
}

func (ms *ReaggregateMetricMetricConfig) Validate() error {
	for _, val := range ms.EnabledAttributes {
		switch val {
		case ReaggregateMetricMetricAttributeKeyStringAttr, ReaggregateMetricMetricAttributeKeyBooleanAttr:
		default:
			return fmt.Errorf("metric reaggregate.metric doesn't have an attribute %v, valid attributes: [string_attr, boolean_attr]", val)
		}
	}

	switch ms.AggregationStrategy {
	case AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax:
	default:
		return fmt.Errorf("invalid aggregation strategy %q, valid strategies: [%s, %s, %s, %s]", ms.AggregationStrategy, AggregationStrategySum, AggregationStrategyAvg, AggregationStrategyMin, AggregationStrategyMax)
	}

	return nil
}

// SystemCPUTimeMetricConfig provides config for the system.cpu.time metric.
type SystemCPUTimeMetricConfig struct {
	Enabled          bool `mapstructure:"enabled"`
	enabledSetByUser bool
}

func (ms *SystemCPUTimeMetricConfig) 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 sample metrics.
type MetricsConfig struct {
	DefaultMetric            DefaultMetricMetricConfig            `mapstructure:"default.metric"`
	DefaultMetricToBeRemoved DefaultMetricToBeRemovedMetricConfig `mapstructure:"default.metric.to_be_removed"`
	MetricInputType          MetricInputTypeMetricConfig          `mapstructure:"metric.input_type"`
	OptionalMetric           OptionalMetricMetricConfig           `mapstructure:"optional.metric"`
	OptionalMetricEmptyUnit  OptionalMetricEmptyUnitMetricConfig  `mapstructure:"optional.metric.empty_unit"`
	ReaggregateMetric        ReaggregateMetricMetricConfig        `mapstructure:"reaggregate.metric"`
	SystemCPUTime            SystemCPUTimeMetricConfig            `mapstructure:"system.cpu.time"`
}

func DefaultMetricsConfig() MetricsConfig {
	return MetricsConfig{
		DefaultMetric: DefaultMetricMetricConfig{
			Enabled:             true,
			AggregationStrategy: AggregationStrategySum,
			EnabledAttributes:   []DefaultMetricMetricAttributeKey{DefaultMetricMetricAttributeKeyStringAttr, DefaultMetricMetricAttributeKeyOverriddenIntAttr, DefaultMetricMetricAttributeKeyEnumAttr, DefaultMetricMetricAttributeKeySliceAttr, DefaultMetricMetricAttributeKeyMapAttr},
		},
		DefaultMetricToBeRemoved: DefaultMetricToBeRemovedMetricConfig{
			Enabled: true,
		},
		MetricInputType: MetricInputTypeMetricConfig{
			Enabled:             true,
			AggregationStrategy: AggregationStrategySum,
			EnabledAttributes:   []MetricInputTypeMetricAttributeKey{MetricInputTypeMetricAttributeKeyStringAttr, MetricInputTypeMetricAttributeKeyOverriddenIntAttr, MetricInputTypeMetricAttributeKeyEnumAttr, MetricInputTypeMetricAttributeKeySliceAttr, MetricInputTypeMetricAttributeKeyMapAttr},
		},
		OptionalMetric: OptionalMetricMetricConfig{
			Enabled:             false,
			AggregationStrategy: AggregationStrategyAvg,
			EnabledAttributes:   []OptionalMetricMetricAttributeKey{OptionalMetricMetricAttributeKeyStringAttr, OptionalMetricMetricAttributeKeyBooleanAttr, OptionalMetricMetricAttributeKeyBooleanAttr2},
		},
		OptionalMetricEmptyUnit: OptionalMetricEmptyUnitMetricConfig{
			Enabled:             false,
			AggregationStrategy: AggregationStrategyAvg,
			EnabledAttributes:   []OptionalMetricEmptyUnitMetricAttributeKey{OptionalMetricEmptyUnitMetricAttributeKeyStringAttr, OptionalMetricEmptyUnitMetricAttributeKeyBooleanAttr},
		},
		ReaggregateMetric: ReaggregateMetricMetricConfig{
			Enabled:             true,
			AggregationStrategy: AggregationStrategyAvg,
			EnabledAttributes:   []ReaggregateMetricMetricAttributeKey{ReaggregateMetricMetricAttributeKeyStringAttr, ReaggregateMetricMetricAttributeKeyBooleanAttr},
		},
		SystemCPUTime: SystemCPUTimeMetricConfig{
			Enabled: true,
		},
	}
}

// MapResourceAttrResourceAttributeConfig provides config for the map.resource.attr resource attribute.
type MapResourceAttrResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	OverrideValue map[string]any `mapstructure:"override_value"`
	// 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 *MapResourceAttrResourceAttributeConfig) 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
}

// OptionalResourceAttrResourceAttributeConfig provides config for the optional.resource.attr resource attribute.
type OptionalResourceAttrResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	OverrideValue *string `mapstructure:"override_value"`
	// 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 *OptionalResourceAttrResourceAttributeConfig) 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
}

// SliceResourceAttrResourceAttributeConfig provides config for the slice.resource.attr resource attribute.
type SliceResourceAttrResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	OverrideValue []any `mapstructure:"override_value"`
	// 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 *SliceResourceAttrResourceAttributeConfig) 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
}

// StringEnumResourceAttrResourceAttributeConfig provides config for the string.enum.resource.attr resource attribute.
type StringEnumResourceAttrResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	// Must be one of: one, two.
	OverrideValue *string `mapstructure:"override_value"`
	// 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 *StringEnumResourceAttrResourceAttributeConfig) 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
}

func (rac *StringEnumResourceAttrResourceAttributeConfig) Validate() error {
	if rac.OverrideValue != nil {
		switch *rac.OverrideValue {
		case "one", "two":
		default:
			return fmt.Errorf("override_value for string.enum.resource.attr must be one of [one, two], got %q", *rac.OverrideValue)
		}
	}
	return nil
}

// StringResourceAttrResourceAttributeConfig provides config for the string.resource.attr resource attribute.
type StringResourceAttrResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	OverrideValue *string `mapstructure:"override_value"`
	// 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 *StringResourceAttrResourceAttributeConfig) 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
}

// StringResourceAttrDisableWarningResourceAttributeConfig provides config for the string.resource.attr_disable_warning resource attribute.
type StringResourceAttrDisableWarningResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	OverrideValue *string `mapstructure:"override_value"`
	// 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 *StringResourceAttrDisableWarningResourceAttributeConfig) 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
}

// StringResourceAttrRemoveWarningResourceAttributeConfig provides config for the string.resource.attr_remove_warning resource attribute.
type StringResourceAttrRemoveWarningResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	OverrideValue *string `mapstructure:"override_value"`
	// 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 *StringResourceAttrRemoveWarningResourceAttributeConfig) 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
}

// StringResourceAttrToBeRemovedResourceAttributeConfig provides config for the string.resource.attr_to_be_removed resource attribute.
type StringResourceAttrToBeRemovedResourceAttributeConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// OverrideValue allows users to override the value of this resource attribute.
	OverrideValue *string `mapstructure:"override_value"`
	// 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 *StringResourceAttrToBeRemovedResourceAttributeConfig) 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 sample resource attributes.
type ResourceAttributesConfig struct {
	MapResourceAttr                  MapResourceAttrResourceAttributeConfig                  `mapstructure:"map.resource.attr"`
	OptionalResourceAttr             OptionalResourceAttrResourceAttributeConfig             `mapstructure:"optional.resource.attr"`
	SliceResourceAttr                SliceResourceAttrResourceAttributeConfig                `mapstructure:"slice.resource.attr"`
	StringEnumResourceAttr           StringEnumResourceAttrResourceAttributeConfig           `mapstructure:"string.enum.resource.attr"`
	StringResourceAttr               StringResourceAttrResourceAttributeConfig               `mapstructure:"string.resource.attr"`
	StringResourceAttrDisableWarning StringResourceAttrDisableWarningResourceAttributeConfig `mapstructure:"string.resource.attr_disable_warning"`
	StringResourceAttrRemoveWarning  StringResourceAttrRemoveWarningResourceAttributeConfig  `mapstructure:"string.resource.attr_remove_warning"`
	StringResourceAttrToBeRemoved    StringResourceAttrToBeRemovedResourceAttributeConfig    `mapstructure:"string.resource.attr_to_be_removed"`
}

func DefaultResourceAttributesConfig() ResourceAttributesConfig {
	return ResourceAttributesConfig{
		MapResourceAttr: MapResourceAttrResourceAttributeConfig{
			Enabled: true,
		},
		OptionalResourceAttr: OptionalResourceAttrResourceAttributeConfig{
			Enabled: false,
		},
		SliceResourceAttr: SliceResourceAttrResourceAttributeConfig{
			Enabled: true,
		},
		StringEnumResourceAttr: StringEnumResourceAttrResourceAttributeConfig{
			Enabled: true,
		},
		StringResourceAttr: StringResourceAttrResourceAttributeConfig{
			Enabled: true,
		},
		StringResourceAttrDisableWarning: StringResourceAttrDisableWarningResourceAttributeConfig{
			Enabled: true,
		},
		StringResourceAttrRemoveWarning: StringResourceAttrRemoveWarningResourceAttributeConfig{
			Enabled: false,
		},
		StringResourceAttrToBeRemoved: StringResourceAttrToBeRemovedResourceAttributeConfig{
			Enabled: true,
		},
	}
}

// applyOverrideValues applies override values to the given resource.
// For each enabled resource attribute with a non-nil OverrideValue,
// the override replaces any existing value in the resource.
func (rac *ResourceAttributesConfig) applyOverrideValues(res pcommon.Resource) {
	if rac.MapResourceAttr.Enabled && rac.MapResourceAttr.OverrideValue != nil {
		res.Attributes().PutEmptyMap("map.resource.attr").FromRaw(rac.MapResourceAttr.OverrideValue)
	}
	if rac.OptionalResourceAttr.Enabled && rac.OptionalResourceAttr.OverrideValue != nil {
		res.Attributes().PutStr("optional.resource.attr", *rac.OptionalResourceAttr.OverrideValue)
	}
	if rac.SliceResourceAttr.Enabled && rac.SliceResourceAttr.OverrideValue != nil {
		res.Attributes().PutEmptySlice("slice.resource.attr").FromRaw(rac.SliceResourceAttr.OverrideValue)
	}
	if rac.StringEnumResourceAttr.Enabled && rac.StringEnumResourceAttr.OverrideValue != nil {
		res.Attributes().PutStr("string.enum.resource.attr", *rac.StringEnumResourceAttr.OverrideValue)
	}
	if rac.StringResourceAttr.Enabled && rac.StringResourceAttr.OverrideValue != nil {
		res.Attributes().PutStr("string.resource.attr", *rac.StringResourceAttr.OverrideValue)
	}
	if rac.StringResourceAttrDisableWarning.Enabled && rac.StringResourceAttrDisableWarning.OverrideValue != nil {
		res.Attributes().PutStr("string.resource.attr_disable_warning", *rac.StringResourceAttrDisableWarning.OverrideValue)
	}
	if rac.StringResourceAttrRemoveWarning.Enabled && rac.StringResourceAttrRemoveWarning.OverrideValue != nil {
		res.Attributes().PutStr("string.resource.attr_remove_warning", *rac.StringResourceAttrRemoveWarning.OverrideValue)
	}
	if rac.StringResourceAttrToBeRemoved.Enabled && rac.StringResourceAttrToBeRemoved.OverrideValue != nil {
		res.Attributes().PutStr("string.resource.attr_to_be_removed", *rac.StringResourceAttrToBeRemoved.OverrideValue)
	}
}

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

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

// Deprecated: Use NewDefaultMetricsBuilderConfig.
func DefaultMetricsBuilderConfig() MetricsBuilderConfig {
	return NewDefaultMetricsBuilderConfig()
}
