package recommend

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	v1 "server/api/recommend/v1"
)

func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
	out, err := service.BookRecommendations().List(ctx, &model.BookRecommendationsListIn{
		Page:   req.Page,
		Size:   req.Size,
		Type:   req.Type,
		Status: req.Status,
		BookId: req.BookId,
	})
	if err != nil {
		return nil, err
	}
	return &v1.ListRes{
		Total: out.Total,
		List:  out.List,
	}, nil
}
