package tutorial.rest.resources.asm;

import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import tutorial.core.models.entities.Account;
import tutorial.rest.mvc.AccountController;
import tutorial.rest.resources.AccountResource;

/**
 * 
 * @author Xavier
 */
public class AccountResourceAsm extends ResourceAssemblerSupport<Account, AccountResource> {

    /**
     *
     */
    public AccountResourceAsm() {
        super(AccountController.class, AccountResource.class);
    }

    /**
     *
     * @param account
     * @return
     */
    @Override
    public AccountResource toResource(Account account) {
        AccountResource res = new AccountResource();
        res.setName(account.getName());
        res.setPassword(account.getPassword());
        res.setAccountType(account.getAccountType());
        res.setActivated(account.getActivated());
        res.setRemoved(account.getRemoved());
        res.setCreated(account.getCreated());
        res.setUpdated(account.getUpdated());
        
        res.setNumber(account.getNumber());
        res.setSpecialty(account.getSpecialty());
        res.setAge(account.getAge());
        res.setGender(account.getGender());
        res.setProvince(account.getProvince());
        return res;
    }
}
