// Code generated by mdatagen. DO NOT EDIT.

package samplepkg

import (
	"errors"
)

type SampleConfig struct {
	// The host name to connect to.
	HostName string `mapstructure:"host_name"`
	// The port to connect to.
	Port string `mapstructure:"port"`
	// prevent unkeyed literal initialization
	_ struct{}
}

// Validate validates the SampleConfig fields according to schema annotations.
func (c *SampleConfig) Validate() error {
	var err error

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

	if len(c.HostName) < 1 {
		err = errors.Join(err, errors.New("host_name must have minimum length of 1"))
	}

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

	return err
}

// NewDefaultSampleConfig returns a new SampleConfig with default values consistent with the annotations in the schema.
func NewDefaultSampleConfig() SampleConfig {
	return SampleConfig{
		HostName: "localhost",
		Port:     "8080",
	}
}
