package tutorial.rest.resources.asm;

import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import tutorial.core.services.util.ActiveIngredientList;
import tutorial.rest.mvc.ActiveIngredientController;
import tutorial.rest.resources.ActiveIngredientListResource;

/**
 * 
 * @author Xavier
 */
public class ActiveIngredientListResourceAsm extends ResourceAssemblerSupport<ActiveIngredientList, ActiveIngredientListResource> {

    /**
     *
     */
    public ActiveIngredientListResourceAsm()
    {
        super(ActiveIngredientController.class, ActiveIngredientListResource.class);
    }

    /**
     *
     * @param activeIngredientList
     * @return
     */
    @Override
    public ActiveIngredientListResource toResource(ActiveIngredientList activeIngredientList) {
        ActiveIngredientListResource res = new ActiveIngredientListResource();
        res.setActiveIngredients(new ActiveIngredientResourceAsm().toResources(activeIngredientList.getActiveIngredients()));
        return res;
    }
}
