// Code generated by github.com/ecordell/optgen. DO NOT EDIT.
package util

import (
	defaults "github.com/creasty/defaults"
	helpers "github.com/ecordell/optgen/helpers"
	"time"
)

type GRPCServerConfigOption func(g *GRPCServerConfig)

// NewGRPCServerConfigWithOptions creates a new GRPCServerConfig with the passed in options set
func NewGRPCServerConfigWithOptions(opts ...GRPCServerConfigOption) *GRPCServerConfig {
	g := &GRPCServerConfig{}
	for _, o := range opts {
		o(g)
	}
	return g
}

// NewGRPCServerConfigWithOptionsAndDefaults creates a new GRPCServerConfig with the passed in options set starting from the defaults
func NewGRPCServerConfigWithOptionsAndDefaults(opts ...GRPCServerConfigOption) *GRPCServerConfig {
	g := &GRPCServerConfig{}
	defaults.MustSet(g)
	for _, o := range opts {
		o(g)
	}
	return g
}

// ToOption returns a new GRPCServerConfigOption that sets the values from the passed in GRPCServerConfig
func (g *GRPCServerConfig) ToOption() GRPCServerConfigOption {
	return func(to *GRPCServerConfig) {
		to.Address = g.Address
		to.Network = g.Network
		to.TLSCertPath = g.TLSCertPath
		to.TLSKeyPath = g.TLSKeyPath
		to.MaxConnAge = g.MaxConnAge
		to.Enabled = g.Enabled
		to.BufferSize = g.BufferSize
		to.ClientCAPath = g.ClientCAPath
		to.MaxWorkers = g.MaxWorkers
		to.flagPrefix = g.flagPrefix
	}
}

// DebugMap returns a map form of GRPCServerConfig for debugging
func (g GRPCServerConfig) DebugMap() map[string]any {
	debugMap := map[string]any{}
	debugMap["Address"] = helpers.DebugValue(g.Address, false)
	debugMap["Network"] = helpers.DebugValue(g.Network, false)
	debugMap["TLSCertPath"] = helpers.DebugValue(g.TLSCertPath, false)
	debugMap["TLSKeyPath"] = helpers.DebugValue(g.TLSKeyPath, false)
	debugMap["MaxConnAge"] = helpers.DebugValue(g.MaxConnAge, false)
	debugMap["Enabled"] = helpers.DebugValue(g.Enabled, false)
	debugMap["BufferSize"] = helpers.DebugValue(g.BufferSize, false)
	debugMap["ClientCAPath"] = helpers.DebugValue(g.ClientCAPath, false)
	debugMap["MaxWorkers"] = helpers.DebugValue(g.MaxWorkers, false)
	return debugMap
}

// GRPCServerConfigWithOptions configures an existing GRPCServerConfig with the passed in options set
func GRPCServerConfigWithOptions(g *GRPCServerConfig, opts ...GRPCServerConfigOption) *GRPCServerConfig {
	for _, o := range opts {
		o(g)
	}
	return g
}

// WithOptions configures the receiver GRPCServerConfig with the passed in options set
func (g *GRPCServerConfig) WithOptions(opts ...GRPCServerConfigOption) *GRPCServerConfig {
	for _, o := range opts {
		o(g)
	}
	return g
}

// WithAddress returns an option that can set Address on a GRPCServerConfig
func WithAddress(address string) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.Address = address
	}
}

// WithNetwork returns an option that can set Network on a GRPCServerConfig
func WithNetwork(network string) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.Network = network
	}
}

// WithTLSCertPath returns an option that can set TLSCertPath on a GRPCServerConfig
func WithTLSCertPath(tLSCertPath string) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.TLSCertPath = tLSCertPath
	}
}

// WithTLSKeyPath returns an option that can set TLSKeyPath on a GRPCServerConfig
func WithTLSKeyPath(tLSKeyPath string) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.TLSKeyPath = tLSKeyPath
	}
}

// WithMaxConnAge returns an option that can set MaxConnAge on a GRPCServerConfig
func WithMaxConnAge(maxConnAge time.Duration) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.MaxConnAge = maxConnAge
	}
}

// WithEnabled returns an option that can set Enabled on a GRPCServerConfig
func WithEnabled(enabled bool) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.Enabled = enabled
	}
}

// WithBufferSize returns an option that can set BufferSize on a GRPCServerConfig
func WithBufferSize(bufferSize int) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.BufferSize = bufferSize
	}
}

// WithClientCAPath returns an option that can set ClientCAPath on a GRPCServerConfig
func WithClientCAPath(clientCAPath string) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.ClientCAPath = clientCAPath
	}
}

// WithMaxWorkers returns an option that can set MaxWorkers on a GRPCServerConfig
func WithMaxWorkers(maxWorkers uint32) GRPCServerConfigOption {
	return func(g *GRPCServerConfig) {
		g.MaxWorkers = maxWorkers
	}
}

type HTTPServerConfigOption func(h *HTTPServerConfig)

// NewHTTPServerConfigWithOptions creates a new HTTPServerConfig with the passed in options set
func NewHTTPServerConfigWithOptions(opts ...HTTPServerConfigOption) *HTTPServerConfig {
	h := &HTTPServerConfig{}
	for _, o := range opts {
		o(h)
	}
	return h
}

// NewHTTPServerConfigWithOptionsAndDefaults creates a new HTTPServerConfig with the passed in options set starting from the defaults
func NewHTTPServerConfigWithOptionsAndDefaults(opts ...HTTPServerConfigOption) *HTTPServerConfig {
	h := &HTTPServerConfig{}
	defaults.MustSet(h)
	for _, o := range opts {
		o(h)
	}
	return h
}

// ToOption returns a new HTTPServerConfigOption that sets the values from the passed in HTTPServerConfig
func (h *HTTPServerConfig) ToOption() HTTPServerConfigOption {
	return func(to *HTTPServerConfig) {
		to.HTTPAddress = h.HTTPAddress
		to.HTTPTLSCertPath = h.HTTPTLSCertPath
		to.HTTPTLSKeyPath = h.HTTPTLSKeyPath
		to.HTTPEnabled = h.HTTPEnabled
		to.flagPrefix = h.flagPrefix
	}
}

// DebugMap returns a map form of HTTPServerConfig for debugging
func (h HTTPServerConfig) DebugMap() map[string]any {
	debugMap := map[string]any{}
	debugMap["HTTPAddress"] = helpers.DebugValue(h.HTTPAddress, false)
	debugMap["HTTPTLSCertPath"] = helpers.DebugValue(h.HTTPTLSCertPath, false)
	debugMap["HTTPTLSKeyPath"] = helpers.DebugValue(h.HTTPTLSKeyPath, false)
	debugMap["HTTPEnabled"] = helpers.DebugValue(h.HTTPEnabled, false)
	return debugMap
}

// HTTPServerConfigWithOptions configures an existing HTTPServerConfig with the passed in options set
func HTTPServerConfigWithOptions(h *HTTPServerConfig, opts ...HTTPServerConfigOption) *HTTPServerConfig {
	for _, o := range opts {
		o(h)
	}
	return h
}

// WithOptions configures the receiver HTTPServerConfig with the passed in options set
func (h *HTTPServerConfig) WithOptions(opts ...HTTPServerConfigOption) *HTTPServerConfig {
	for _, o := range opts {
		o(h)
	}
	return h
}

// WithHTTPAddress returns an option that can set HTTPAddress on a HTTPServerConfig
func WithHTTPAddress(hTTPAddress string) HTTPServerConfigOption {
	return func(h *HTTPServerConfig) {
		h.HTTPAddress = hTTPAddress
	}
}

// WithHTTPTLSCertPath returns an option that can set HTTPTLSCertPath on a HTTPServerConfig
func WithHTTPTLSCertPath(hTTPTLSCertPath string) HTTPServerConfigOption {
	return func(h *HTTPServerConfig) {
		h.HTTPTLSCertPath = hTTPTLSCertPath
	}
}

// WithHTTPTLSKeyPath returns an option that can set HTTPTLSKeyPath on a HTTPServerConfig
func WithHTTPTLSKeyPath(hTTPTLSKeyPath string) HTTPServerConfigOption {
	return func(h *HTTPServerConfig) {
		h.HTTPTLSKeyPath = hTTPTLSKeyPath
	}
}

// WithHTTPEnabled returns an option that can set HTTPEnabled on a HTTPServerConfig
func WithHTTPEnabled(hTTPEnabled bool) HTTPServerConfigOption {
	return func(h *HTTPServerConfig) {
		h.HTTPEnabled = hTTPEnabled
	}
}
