package greet

import (
	"context"

	"github.com/rs/zerolog/log"
)

type ServiceV2 struct{}

func NewServiceV2() *ServiceV2 {
	return &ServiceV2{}
}

// GreetV2 returns a v2 greeting message for the given name.
// If name is empty, it defaults to "friend".
// This is the v2 implementation that returns "Hello my friend <name>!"
func (s *ServiceV2) GreetV2(ctx context.Context, name string) string {
	log.Trace().Ctx(ctx).Str("name", name).Msg("GreetV2 function called")

	if name == "" {
		return "Hello my friend!"
	}
	return "Hello my friend " + name + "!"
}
