package service

import (
	"dubbo.apache.org/dubbo-go/v3/config"
	"github.com/fonchain/fonchain-artistinfo/pb/artwork"
	"github.com/fonchain/fonchain-artistinfo/pb/artwork_query"

	//_ "dubbo.apache.org/dubbo-go/v3/imports"
	"github.com/fonchain/fonchain-artistinfo/pb/account"
	"github.com/fonchain/fonchain-artistinfo/pb/artist"
	contractMicroservice "github.com/fonchain/fonchain-artistinfo/pb/contract_microservice"
)

var (
	GrpcArtistImpl   = new(artist.ArtistClientImpl)
	AccountProvider  = new(account.AccountClientImpl)
	ArtworkImpl      = new(artwork.ArtworkClientImpl)
	ArtworkQueryImpl = new(artwork_query.ArtworkQueryClientImpl)
	ContractImpl     = new(contractMicroservice.ContractMicroserviceClientImpl)
)

func init() {
	config.SetConsumerService(GrpcArtistImpl)
	config.SetConsumerService(AccountProvider)
	config.SetConsumerService(ArtworkImpl)
	config.SetConsumerService(ArtworkQueryImpl)
	config.SetConsumerService(ContractImpl)
	//if os.Args[len(os.Args)-1] == "unit-test" {
	//	_ = os.Setenv(constant.ConfigFileEnvKey, "../../conf/dubbogo.yaml")
	//}
	//fmt.Println(os.Getenv(constant.ConfigFileEnvKey))
	//if err := config.Load(); err != nil {
	//	panic(err)
	//}
}
