package recipientimp

import (
	messaging "github.com/tech/sendico/pkg/messaging/envelope"
	notifications "github.com/tech/sendico/pkg/messaging/notifications/object"
	"github.com/tech/sendico/pkg/model"
	nm "github.com/tech/sendico/pkg/model/notification"
	"go.mongodb.org/mongo-driver/v2/bson"
)

func (a *RecipientAPI) notification(
	recipient *model.Recipient,
	actorAccountRef bson.ObjectID,
	t nm.NotificationAction,
) messaging.Envelope {
	objectRef := bson.NilObjectID
	if recipient != nil {
		objectRef = recipient.ID
	}

	return notifications.Object(a.Name(), actorAccountRef, a.Name(), objectRef, t)
}
