package com.nisum.mytime.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.EmployeeLocationDetails;
import com.nisum.mytime.service.impl.EmployeeLocationService;

@RestController
public class EmployeeLocationController {

	@Autowired
	EmployeeLocationService empLocationService;
	
	@RequestMapping(value = "/getEmployeeLocations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<EmployeeLocationDetails>> getEmployeeLocations(@RequestParam("employeeId") String empId)
			throws MyTimeException {
		List<EmployeeLocationDetails> employeeLocationDetails = empLocationService.getEmployeeLocationDetails(empId);
		return new ResponseEntity<>(employeeLocationDetails, HttpStatus.OK);
	}
}
