// Code generated by mdatagen. DO NOT EDIT.

package samplereceiver

import (
	"errors"
	"time"

	"go.opentelemetry.io/collector/cmd/mdatagen/internal/samplepkg"
	"go.opentelemetry.io/collector/cmd/mdatagen/internal/samplereceiver/internal/metadata"
	"go.opentelemetry.io/collector/component"
)

// Config defines the configuration for Sample Receiver component.
type Config struct {
	// MetricsBuilderConfig is a configuration for sample metrics builder.
	metadata.MetricsBuilderConfig `mapstructure:",squash"`
	// The endpoint to scrape metrics from.
	Endpoint  string                 `mapstructure:"endpoint"`
	SamplePkg samplepkg.SampleConfig `mapstructure:"sample_pkg"`
	// Timeout for scraping metrics.
	Timeout time.Duration `mapstructure:"timeout"`
	// prevent unkeyed literal initialization
	_ struct{}
}

// Validate validates the Config fields.
func (c *Config) Validate() error {
	var err error

	if c.Endpoint == "" {
		err = errors.Join(err, errors.New("endpoint is required"))
	}

	return err
}

func createDefaultConfig() component.Config {
	return &Config{
		Endpoint:  "localhost:12345",
		SamplePkg: samplepkg.NewDefaultSampleConfig(),
		Timeout:   10 * time.Second,
	}
}
