package com.rjconsultores.ventaboletos.rest;

import javax.annotation.security.RolesAllowed;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.rjconsultores.ventaboletos.rest.bean.ParamsLogin;
import com.rjconsultores.ventaboletos.rest.service.LoginService;
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;

@Path("/logar")
public class LoginRS {

	@POST
	@Consumes({ MediaType.APPLICATION_JSON })
	@RolesAllowed("EMBARCADA")
	@Produces({ MediaType.APPLICATION_JSON })
	public Response login(ParamsLogin params) {
		LoginService service = (LoginService) AppContext.getApplicationContext().getBean("loginService");
		return Response.ok(service.logar(params), MediaType.APPLICATION_JSON).build();
	}
	
}
