// Code generated by mdatagen. DO NOT EDIT.

package controller

import (
	"errors"
	"time"
)

// ControllerConfig defines common settings for a scraper controller configuration. Scraper controller receivers can embed this struct, instead of receiver.Settings, and extend it with more fields if needed.
type ControllerConfig struct {
	// CollectionInterval sets how frequently the scraper is scheduled.
	CollectionInterval time.Duration `mapstructure:"collection_interval"`

	// InitialDelay sets the initial start delay for the scraper, any non positive value is assumed to be immediately.
	InitialDelay time.Duration `mapstructure:"initial_delay"`

	// Timeout an optional value used to set scraper's context deadline.
	Timeout time.Duration `mapstructure:"timeout"`

	// prevent unkeyed literal initialization
	_ struct{}
}

// Validate validates the ControllerConfig fields according to schema annotations.
// Called by confmap on config resolution. Don't call it explicitly to avoid duplicate errors.
func (c *ControllerConfig) Validate() error {
	var err error

	if inner_err := validateControllerConfig(c); inner_err != nil {
		err = errors.Join(err, inner_err)
	}

	return err
}

// NewDefaultControllerConfig returns a new ControllerConfig with its default values applied.
// Prefer this over an empty struct literal so default changes stay in sync automatically.
func NewDefaultControllerConfig() ControllerConfig {
	return ControllerConfig{
		CollectionInterval: 1 * time.Minute,
		InitialDelay:       1 * time.Second,
		Timeout:            0,
	}
}
