// Code generated by mdatagen. DO NOT EDIT.

package metadata

import (
	"fmt"

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

// 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
}

// 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"`
}

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},
		},
	}
}

// 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 sample resource attributes.
type ResourceAttributesConfig struct {
	MapResourceAttr                  ResourceAttributeConfig `mapstructure:"map.resource.attr"`
	OptionalResourceAttr             ResourceAttributeConfig `mapstructure:"optional.resource.attr"`
	SliceResourceAttr                ResourceAttributeConfig `mapstructure:"slice.resource.attr"`
	StringEnumResourceAttr           ResourceAttributeConfig `mapstructure:"string.enum.resource.attr"`
	StringResourceAttr               ResourceAttributeConfig `mapstructure:"string.resource.attr"`
	StringResourceAttrDisableWarning ResourceAttributeConfig `mapstructure:"string.resource.attr_disable_warning"`
	StringResourceAttrRemoveWarning  ResourceAttributeConfig `mapstructure:"string.resource.attr_remove_warning"`
	StringResourceAttrToBeRemoved    ResourceAttributeConfig `mapstructure:"string.resource.attr_to_be_removed"`
}

func DefaultResourceAttributesConfig() ResourceAttributesConfig {
	return ResourceAttributesConfig{
		MapResourceAttr: ResourceAttributeConfig{
			Enabled: true,
		},
		OptionalResourceAttr: ResourceAttributeConfig{
			Enabled: false,
		},
		SliceResourceAttr: ResourceAttributeConfig{
			Enabled: true,
		},
		StringEnumResourceAttr: ResourceAttributeConfig{
			Enabled: true,
		},
		StringResourceAttr: ResourceAttributeConfig{
			Enabled: true,
		},
		StringResourceAttrDisableWarning: ResourceAttributeConfig{
			Enabled: true,
		},
		StringResourceAttrRemoveWarning: ResourceAttributeConfig{
			Enabled: false,
		},
		StringResourceAttrToBeRemoved: ResourceAttributeConfig{
			Enabled: true,
		},
	}
}

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

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