/*
 * 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.ModelParameter;
import com.arrebol.apc.model.catalog.RouteCtlg;
import com.arrebol.apc.model.catalog.constance.RouteCfg;
import com.arrebol.apc.model.core.Office;
import com.arrebol.apc.model.enums.ActiveStatus;
import com.arrebol.apc.repository.LazyDataModelDAORepository;
import java.util.ArrayList;
import java.util.List;
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 RouteServiceImpl extends LazyDataModelDAORepository<RouteCtlg> implements RouteService {

    @Override
    public List<RouteCtlg> fillRoutesDatatable(String officeId) {
        logger.debug("fillRoutesDatatable");
        List<ModelParameter> parameters = new ArrayList<>();

        parameters.add(new ModelParameter(RouteCfg.FIELD_ACTIVE_STATUS, ActiveStatus.ENEBLED));
        parameters.add(new ModelParameter(RouteCfg.FIELD_OFFICE, new Office(officeId)));

        return xmlQueryAPCEntities(RouteCtlg.class, RouteCfg.QUERY_FIND_ALL_ROUTES, parameters);
    }

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

}
