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

import (
	"context"

	"git.threesix.ai/jordan/persona-community-5/pkg/logging"
	"git.threesix.ai/jordan/persona-community-5/services/persona-api/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
}
