package health

type config struct {
	liveChecks    []Checker
	readyChecks   []Checker
	maxConcurrent int
}

type Option func(cfg *config)

const maxConcurrentDefault = 5

func newConfig(opts ...Option) *config {
	cfg := &config{
		maxConcurrent: maxConcurrentDefault,
	}

	for _, opt := range opts {
		opt(cfg)
	}

	return cfg
}

func WithMaxConcurrent(max int) Option {
	return func(cfg *config) {
		cfg.maxConcurrent = max
	}
}

func WithLiveCheck(check Checker) Option {
	return func(cfg *config) {
		cfg.liveChecks = append(cfg.liveChecks, check)
	}
}

func WithReadyCheck(check Checker) Option {
	return func(cfg *config) {
		cfg.readyChecks = append(cfg.readyChecks, check)
	}
}
