/*
 * Arrebol Consultancy copyright.
 * 
 * This code belongs to Arrebol Consultancy
 * its use, redistribution or modification are prohibited 
 * without written authorization from Arrebol Consultancy.
 */
package com.arrebol.apc.service.catalog;

import com.arrebol.apc.model.loan.Loan;
import com.arrebol.apc.model.loan.LoanByUser;
import com.arrebol.apc.model.loan.LoanDetails;
import com.arrebol.apc.repository.LazyDataModelDAORepository;
import javax.enterprise.context.RequestScoped;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 *
 * @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
 */
@RequestScoped
public class LoanServiceImpl extends LazyDataModelDAORepository<Loan> implements LoanService {

    @Override
    public boolean saveLoan(Loan loan) {
        logger.debug("saveLoan");
        return save(loan);
    }

    @Override
    public Loan getLoanById(String loanId) {
        logger.debug("getLoanById");

        return (Loan) findAPCEntity(Loan.class, loanId);
    }

    @Override
    public boolean saveLoanByUser(LoanByUser loanByUser) {
        logger.debug("saveLoanByUser");
        return save(loanByUser);
    }

    @Override
    public boolean saveLoanDetail(LoanDetails loanDetails) {
        logger.debug("saveLoanDetail");
        return save(loanDetails);
    }

    final Logger logger = LogManager.getLogger(getClass());
}
