package tcms

import (
	"github.com/pingcap/test-infra/common/client/tcms/client"
	"github.com/pingcap/test-infra/common/client/tcms/taskruns"
)

type ClientSet interface {
	TestbedSetupClient() taskruns.TestbedSetupClient
	SvcTaskClient() taskruns.SvcTaskClient
	SvcTaskRunClient() taskruns.SvcTaskRunClient
	TcmsClient() client.TcmsClient
}

type clientSet struct {
	tcmsClient client.TcmsClient
}

func (c clientSet) TestbedSetupClient() taskruns.TestbedSetupClient {
	return taskruns.NewTestbedSetupClient(c.tcmsClient)
}

func (c clientSet) SvcTaskClient() taskruns.SvcTaskClient {
	return taskruns.NewSvcTaskClient(c.tcmsClient)
}

func (c clientSet) SvcTaskRunClient() taskruns.SvcTaskRunClient {
	return taskruns.NewSvcTaskRunClient(c.tcmsClient)
}

func (c clientSet) TcmsClient() client.TcmsClient {
	return c.tcmsClient
}

func NewTcmsClientSet(cfg client.TcmsClientCfg) ClientSet {
	return clientSet{tcmsClient: client.NewTcmsClient(cfg)}
}
