package tivan

import (
	"github.com/Azure/AzureDefender-K8S-InClusterDefense/pkg/infra/instrumentation/metric"
	tivanInstrumentation "tivan.ms/libs/instrumentation"
)

// WrapperTivanMetricSubmitterFactory implement the IMetricSubmitterFactory and creates the default metric submitter.
// It wraps Tivan's MetricSubmitter
type WrapperTivanMetricSubmitterFactory struct {
	// configuration is the configuration of the metric submitter
	configuration *MetricSubmitterConfiguration
	// metricSubmitter is the metric submitter of tivan
	metricSubmitter tivanInstrumentation.MetricSubmitter
}

// MetricSubmitterConfiguration is the configuration for the metric submitter.
type MetricSubmitterConfiguration struct {
}

// NewMetricSubmitterFactory creates WrapperTivanMetricSubmitterFactory that creates metric submitter by wrapping the metric submitter of Tivan
func NewMetricSubmitterFactory(configuration *MetricSubmitterConfiguration, metricSubmitter tivanInstrumentation.MetricSubmitter) (factory metric.IMetricSubmitterFactory) {
	return &WrapperTivanMetricSubmitterFactory{
		configuration:   configuration,
		metricSubmitter: metricSubmitter,
	}
}

// CreateMetricSubmitter creates new IMetricSubmitter by using the metric submitter of Tivan
func (factory *WrapperTivanMetricSubmitterFactory) CreateMetricSubmitter() (metricSubmitter metric.IMetricSubmitter) {
	return NewWrapperTivanMetricSubmitter(factory.metricSubmitter)
}

{'avg_line_length': 43.36363636363637, 'max_line_length': 172, 'alphanum_fraction': 0.8546470999301188, 'licenses': ['MIT'], 'repository_name': 't-mkremer/AzureDefender-K8S-InClusterDefense', 'path': 'pkg/infra/instrumentation/tivan/wrapper_tivan_metric_submitter_factory.go', 'size': 1431, 'lang': 'GO'}