// Code generated by mdatagen. DO NOT EDIT.

package controller

import (
	"errors"
	"time"
)

// ControllerConfig 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 should be called and used as the context timeout to ensure that scrapers don't exceed the interval.
	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 is 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.
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 default values consistent with the annotations in the schema.
func NewDefaultControllerConfig() ControllerConfig {
	return ControllerConfig{
		CollectionInterval: 1 * time.Minute,
		InitialDelay:       1 * time.Second,
		Timeout:            0,
	}
}
