package repository

import (
	"context"

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

// OrderRepository defines the contract for order persistence.
type OrderRepository interface {
	// Save persists an order (insert or update).
	Save(ctx context.Context, order *entity.Order) error

	// FindByID retrieves an order by its unique ID.
	FindByID(ctx context.Context, id string) (*entity.Order, error)

	// FindByUserID retrieves all orders belonging to a specific user.
	FindByUserID(ctx context.Context, userID string) ([]*entity.Order, error)

	// FindActive retrieves all orders with active status (pending or partial).
	FindActive(ctx context.Context) ([]*entity.Order, error)

	// FindByCouponID retrieves all orders for a specific coupon.
	FindByCouponID(ctx context.Context, couponID string) ([]*entity.Order, error)

	// UpdateStatus updates the status and fill quantities of an order.
	UpdateStatus(ctx context.Context, order *entity.Order) error

	// FindAll retrieves all orders with optional pagination.
	FindAll(ctx context.Context, offset, limit int) ([]*entity.Order, int, error)

	// FindByUserIDPaginated retrieves paginated orders for a user with optional status filter.
	FindByUserIDPaginated(ctx context.Context, userID string, status string, offset, limit int) ([]*entity.Order, int, error)
}
