package com.jasamedika.medifirst2000.controller;

import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.RekapPemenangService;
import com.jasamedika.medifirst2000.vo.KartuPengendaliDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;

@RestController
@RequestMapping("/rekap-pemenang")
public class RekapPemenangController extends LocaleController<KartuPengendaliDetailVO> {

	@Autowired
	private RekapPemenangService rekapPemenangService;

	@RequestMapping(value = "/get-rekap-pemenang", method = GET, produces = APPLICATION_JSON_VALUE)
	public Map<String, Object> getKartuPengendaliHeaderByNoRec(@RequestParam(value = "noRec") String noRec) {
		return rekapPemenangService.rekapPemenang(noRec);
	}

	@RequestMapping(value = "/detail-rekap-pemenang", method = GET, produces = APPLICATION_JSON_VALUE)
	public Map<String, Object> detailRekapPemenang(
			@RequestParam(value = "noRecKartuPengendaliId") String noRecKartuPengendaliId,
			@RequestParam(value = "supplierId") Integer supplierId) {
		return rekapPemenangService.detailRekapPemenang(supplierId, noRecKartuPengendaliId);
	}

}
