//
// Copyright (C) 2024 veypi <i@veypi.com>
// 2025-03-04 16:08:06
// Distributed under terms of the MIT license.
//

package sms

import (
	"fmt"
)

// Provider 短信提供商接口
type Provider interface {
	Send(phone, code string) error
}

// NewProvider 创建短信提供商
func NewProvider(providerType, accessKey, accessSecret, signName, templateCode string) (Provider, error) {
	switch providerType {
	case "aliyun":
		return NewAliyunProvider(accessKey, accessSecret, signName, templateCode)
	case "tencent":
		return NewTencentProvider(accessKey, accessSecret, signName, templateCode)
	default:
		return nil, fmt.Errorf("unsupported sms provider: %s", providerType)
	}
}
