// Package email provides email sending adapters for authentication flows.
package email

import (
	"context"

	"{{GO_MODULE}}/pkg/logging"
	"{{GO_MODULE}}/services/{{COMPONENT_NAME}}/internal/port"
)

// Compile-time interface check.
var _ port.EmailSender = (*LogSender)(nil)

// LogSender logs emails to the console instead of sending them.
// Useful for development and testing when no notify service is configured.
type LogSender struct {
	logger *logging.Logger
}

// NewLogSender creates a new log-based email sender.
func NewLogSender(logger *logging.Logger) *LogSender {
	return &LogSender{logger: logger.WithComponent("EmailSender")}
}

func (s *LogSender) SendAuthCode(_ context.Context, email, code, purpose string) error {
	s.logger.Warn("DEV MODE — email not sent, code logged",
		"to", email,
		"purpose", purpose,
		"code", code,
	)
	return nil
}
