package repository

import (
	"context"

	"github.com/genex/chain-indexer/internal/domain/entity"
)

// TransactionRepository defines the contract for on-chain transaction persistence.
// Infrastructure layer must provide the concrete implementation.
type TransactionRepository interface {
	// Save persists a chain transaction.
	Save(ctx context.Context, tx *entity.ChainTransaction) error

	// SaveBatch persists multiple transactions in a single operation.
	SaveBatch(ctx context.Context, txs []*entity.ChainTransaction) error

	// FindByHash retrieves a transaction by its hash. Returns nil if not found.
	FindByHash(ctx context.Context, hash string) (*entity.ChainTransaction, error)

	// FindByBlock returns all transactions belonging to a given block height.
	FindByBlock(ctx context.Context, blockHeight int64) ([]*entity.ChainTransaction, error)
}
