package tutorial.rest.resources.asm;

import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import java.util.List;
import tutorial.core.services.util.EmailDomainList;
import tutorial.rest.mvc.EmailDomainController;
import tutorial.rest.resources.EmailDomainListResource;
import tutorial.rest.resources.EmailDomainResource;

/**
 * 
 * @author Xavier
 */
public class EmailDomainListResourceAsm extends ResourceAssemblerSupport<EmailDomainList, EmailDomainListResource> {

    /**
     *
     */
    public EmailDomainListResourceAsm() {
        super(EmailDomainController.class, EmailDomainListResource.class);
    }

    /**
     *
     * @param emailDomainList
     * @return
     */
    @Override
    public EmailDomainListResource toResource(EmailDomainList emailDomainList) {
        List<EmailDomainResource> resList = new EmailDomainResourceAsm().toResources(emailDomainList.getEmailDomains());
        EmailDomainListResource finalRes = new EmailDomainListResource();
        finalRes.setEmailDomains(resList);
        return finalRes;
    }
}
