package com.jasamedika.medifirst2000.controller;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.GenericView;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.GenericViewService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.GenericViewVO;
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;

/**
 * Controller class for Pengakjian Awal Gawat Darurat Business
 * 
 * @author Askur
 */
@RestController
@RequestMapping("/genericView")
@JsonIgnoreProperties(ignoreUnknown = true) 
public class GenericViewController extends LocaleController<GenericViewVO> implements
		IBaseRestController<GenericViewVO> {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(GenericViewController.class);

	@Autowired
	private GenericViewService papGenericViewService;

	@RequestMapping(value = "/StatusAdaTidakAda", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findAdaTidakAda(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("yaTidak");
		/*
		Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
		if(dataFound){
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
		}else{
			mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
		}*/
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/StatusRegulerIrreguler", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByRegulerIrreguler(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("regulerIrreguler");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/StatusNormalTidakNormal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByNormalTidakNormal(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("normalTidakNormal");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/StatusBebasTerbatas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByBebasTerbatas(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("bebasTerbatas");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/DataAlatBantuNafas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByAlatBantuNafas(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("alatBantuNafas");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/Akral", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByAkral(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("akral");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/Crt", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByCrt(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("crt");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/IntensitasNadi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByIntensitasNadi(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("intensitasNadi");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/Kesadaran", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByKesadaran(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("kesadaran");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/Mulut", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByMulut(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("mulut");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/StatusPsikologi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByStatusPsikologi(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("statusPsikologi");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/TempatTinggal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByTempatTinggal(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("tempatTinggal");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/BaikTidakBaik", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericViewVO>> findByBaikTidakBaik(HttpServletRequest request) {
		List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("baikTidakBaik");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@RequestMapping(value = "/Test", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<List<GenericView>> findByTest(HttpServletRequest request) {
		List<GenericView> list = papGenericViewService.findGenericViewByPrevix("test");
		return RestUtil.getJsonResponse(list, HttpStatus.OK);
	}

	@Override
	public ResponseEntity<Collection<GenericViewVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
			Integer limit, String sort, String dir) {
		return null;
	}

	@Override
	public ResponseEntity<GenericViewVO> getVO(Integer id) {
		return null;
	}

	@Override
	public ResponseEntity<String> addVO(GenericViewVO vo) {
		return null;
	}

	@Override
	public ResponseEntity<String> editVO(GenericViewVO vo) {
		return null;
	}

	@Override
	public ResponseEntity<String> deleteVO(Integer id) {
		return null;
	}

	@Override
	public ResponseEntity<List<GenericViewVO>> getAllVO() {
		return null;
	}

}
