package tutorial.rest.resources.asm;

import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import java.util.List;
import tutorial.core.services.util.ActiveIngredientRecomendationList;
import tutorial.rest.mvc.ActiveIngredientController;
import tutorial.rest.resources.ActiveIngredientRecomendationListResource;
import tutorial.rest.resources.ActiveIngredientRecomendationResource;

/**
 * 
 * @author Xavier
 */
public class ActiveIngredientRecomendationListResourceAsm extends ResourceAssemblerSupport<ActiveIngredientRecomendationList, ActiveIngredientRecomendationListResource> {

    /**
     *
     */
    public ActiveIngredientRecomendationListResourceAsm() {
        super(ActiveIngredientController.class, ActiveIngredientRecomendationListResource.class);
    }

    /**
     *
     * @param list
     * @return
     */
    @Override
    public ActiveIngredientRecomendationListResource toResource(ActiveIngredientRecomendationList list) {
        List<ActiveIngredientRecomendationResource> resources = new ActiveIngredientRecomendationResourceAsm().toResources(list.getEntries());
        ActiveIngredientRecomendationListResource listResource = new ActiveIngredientRecomendationListResource();
        listResource.setEntries(resources);
        return listResource;
    }
}
