package recipientdb

import (
	"context"

	"github.com/tech/sendico/pkg/mutil/mzap"
	"go.mongodb.org/mongo-driver/v2/bson"
	"go.uber.org/zap"
)

func (db *RecipientDB) SetArchived(ctx context.Context, accountRef, organizationRef, objectRef bson.ObjectID, isArchived, cascade bool) error {
	if err := db.ArchivableDB.SetArchived(ctx, accountRef, objectRef, isArchived); err != nil {
		db.DBImp.Logger.Warn("Failed to change recipient archive status", zap.Error(err),
			mzap.AccRef(accountRef), mzap.ObjRef("organization_ref", organizationRef),
			mzap.ObjRef("recipient_ref", objectRef), zap.Bool("archived", isArchived), zap.Bool("cascade", cascade))
		return err
	}

	return nil
}
