package salidasautomaticas.services;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import salidasautomaticas.dao.DAOFactory;
import salidasautomaticas.dao.SalidasDAO;

/**
 *
 * @author sistem19user
 */
public class SalidasServices {
    private static final Logger log = LogManager.getLogger(SalidasServices.class);
    
    DAOFactory daofactory = DAOFactory.getFactory(DAOFactory.MYSQL);
    SalidasDAO salidadao = daofactory.getSalidasDAO();

    public JSONArray obtenerHorariosSalida() throws Exception {
        JSONArray listaHorarios = null;

        try {
            listaHorarios = salidadao.obtenerHorariosSalida();
        } catch (Exception e) {
            log.error("error", e);
        }

        return listaHorarios;
    }

    public JSONObject actualizarSalidas(String horaSalida) {
        JSONObject valor = new JSONObject();
        try {
            valor = salidadao.actualizarSalida(horaSalida);
        } catch (Exception e) {
            log.error("error", e);
        }
        return valor;
    }
    
    public JSONObject asignarHorarioSalida(){
        JSONObject valor = new JSONObject();
        try {
            valor = salidadao.asignarHorarioSalida();
        } catch (Exception e) {
            log.error("error", e);
        }
        return valor;
    }

}
