package health

import (
	"context"
)

type GetClickhouseConsumerFunc func() (ClickhouseConnCheckInterface, error)

func NewClickhouseCheck(fn GetClickhouseConsumerFunc) CheckFunc {
	return func(ctx context.Context) error {
		conn, err := fn()
		if err != nil {
			return err
		}

		return conn.Ping(ctx)
	}
}

type ClickhouseConnCheckInterface interface {
	Ping(ctx context.Context) error
}
