/*
 * 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.ws.employee;

import com.arrebol.apc.controller.mobile.controller.tracking.PaymentTrackingController;
import com.arrebol.apc.controller.mobile.moxy.views.PaymentTrackingViewJaxb;
import java.io.Serializable;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 *
 * @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
 */
@Path("employee")
public class EmployeeWS implements Serializable {

    @GET
    @Path("payment-traking")
    @Produces(MediaType.APPLICATION_JSON)
    public Response paymentTraking(@QueryParam("id") String userId, @QueryParam("office") String officeId) {
        logger.debug("paymentTraking");
        Response response;
        try {
            PaymentTrackingController controller = new PaymentTrackingController();
            PaymentTrackingViewJaxb paymentTracking = controller.paymentTrakingByUserDetails(userId, officeId);
            
            response = Response.ok(paymentTracking).build();
        } catch (Exception e) {
            logger.error("paymentTraking", e);
            response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
        }
        return response;
    }

    private static final long serialVersionUID = -4827528662562714898L;
    final Logger logger = LogManager.getLogger(EmployeeWS.class);
}
