package callbacksdb

import (
	"context"

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

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