package tutorial.rest.resources.asm;

import org.springframework.hateoas.mvc.ResourceAssemblerSupport;

import tutorial.core.models.entities.ActiveIngredient;
import tutorial.rest.mvc.ActiveIngredientController;
import tutorial.rest.resources.ActiveIngredientResource;

/**
 * 
 * @author Xavier
 */
public class ActiveIngredientResourceAsm extends ResourceAssemblerSupport<ActiveIngredient, ActiveIngredientResource> {

    /**
     *
     */
    public ActiveIngredientResourceAsm() {
        super(ActiveIngredientController.class, ActiveIngredientResource.class);
    }

    /**
     *
     * @param activeIngredient
     * @return
     */
    @Override
    public ActiveIngredientResource toResource(ActiveIngredient activeIngredient) {
        ActiveIngredientResource resource = new ActiveIngredientResource();
        resource.setName(activeIngredient.getName());
        resource.setCounterIndication(activeIngredient.getCounterIndication());
        resource.setCaution(activeIngredient.getCaution());
        
        resource.setMonitoringYes(activeIngredient.getMonitoringYes());
        resource.setMonitoringNo(activeIngredient.getMonitoringNo());
        resource.setAdjustmentsYes(activeIngredient.getAdjustmentsYes());
        resource.setAdjustmentsNo(activeIngredient.getAdjustmentsNo());
        resource.setSymptoms(activeIngredient.getSymptoms());
        return resource;
    }
}
