package confirmationdb

import (
	"context"

	"github.com/tech/sendico/pkg/db/repository"
	"github.com/tech/sendico/pkg/model"
	"go.mongodb.org/mongo-driver/bson/primitive"
)

func (db *ConfirmationDB) DeleteTuple(ctx context.Context, accountRef primitive.ObjectID, destination string, target model.ConfirmationTarget) error {
	query := repository.Query().
		Filter(repository.Field(fieldAccountRef), accountRef).
		Filter(repository.Field(fieldDestination), destination).
		Filter(repository.Field(fieldTarget), target)
	return db.DeleteMany(ctx, query)
}
