package moudle

import (
	"SafelineAPI/internal/app/config"
	"errors"
	"github.com/go-acme/lego/v4/challenge"
)

func ChooseDNSProvider(config config.DNSProviderConfig) (challenge.Provider, error) {
	if config.DNSProvider == "TencentCloud" {
		return config.TencentCloud.Provider()
	} else if config.DNSProvider == "AliCloud" {
		return config.AliCloud.Provider()
	} else if config.DNSProvider == "HuaweiCloud" {
		return config.HuaweiCloud.Provider()
	} else if config.DNSProvider == "WestCN" {
		return config.WestCN.Provider()
	} else if config.DNSProvider == "RainYun" {
		return config.RainYun.Provider()
	} else if config.DNSProvider == "Cloudflare" {
		return config.Cloudflare.Provider()
	} else if config.DNSProvider == "Dode" {
		return config.Dode.Provider()
	}
	return nil, errors.New("DNS provider not configured correctly")
}
