package aapitemplate

import (
	"context"

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

type DB[T any] interface {
	Create(ctx context.Context, accountRef bson.ObjectID, object *T) error
	Get(ctx context.Context, accountRef, objectRef bson.ObjectID, result *T) error
	Update(ctx context.Context, accountRef bson.ObjectID, object *T) error
	Patch(ctx context.Context, accountRef, objectRef bson.ObjectID, patch builder.Patch) error
	Delete(ctx context.Context, accountRef, objectRef bson.ObjectID) error
	List(ctx context.Context, accountRef, organizationRef bson.ObjectID) ([]T, error)
}

type ReorderDB interface {
	Reorder(ctx context.Context, accountRef, objectRef bson.ObjectID, newIndex int, filter builder.Query) error
}
