package repository

import (
	"context"

	"github.com/genex/trading-service/internal/domain/entity"
)

// TradeRepository defines the contract for trade persistence.
type TradeRepository interface {
	// Save persists a trade record.
	Save(ctx context.Context, trade *entity.Trade) error

	// FindByID retrieves a trade by its unique ID.
	FindByID(ctx context.Context, id string) (*entity.Trade, error)

	// FindByOrderID retrieves all trades associated with a given order ID
	// (either as buy order or sell order).
	FindByOrderID(ctx context.Context, orderID string) ([]*entity.Trade, error)

	// FindRecent retrieves the most recent trades, limited by count.
	FindRecent(ctx context.Context, limit int) ([]*entity.Trade, error)

	// FindByCouponID retrieves all trades for a given coupon.
	FindByCouponID(ctx context.Context, couponID string) ([]*entity.Trade, error)

	// Count returns the total number of trades.
	Count(ctx context.Context) (int64, error)
}
