// File Path: monorepo/cloud/maplepress-backend/pkg/emailer/mailgun/provider.go
package mailgun

import (
	"go.uber.org/zap"

	"codeberg.org/mapleopentech/monorepo/cloud/maplepress-backend/config"
)

// ProvideMailgunConfigurationProvider creates a new Mailgun configuration provider from the application config.
func ProvideMailgunConfigurationProvider(cfg *config.Config) MailgunConfigurationProvider {
	return NewMailgunConfigurationProvider(
		cfg.Mailgun.SenderEmail,
		cfg.Mailgun.Domain,
		cfg.Mailgun.APIBase,
		cfg.Mailgun.MaintenanceEmail,
		cfg.Mailgun.FrontendDomain,
		cfg.Mailgun.BackendDomain,
		cfg.Mailgun.APIKey,
	)
}

// ProvideEmailer creates a new Mailgun emailer from the configuration provider.
func ProvideEmailer(config MailgunConfigurationProvider, logger *zap.Logger) Emailer {
	return NewEmailer(config, logger)
}
