package com.madeu.controller.mobile.mobilesystem;

import com.madeu.service.mobile.mobilesystem.MobileSystemService;
import com.madeu.util.HttpUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;

@Slf4j
@Controller
public class MobileSystemController {

	@Autowired
	private MobileSystemService mobileSystemService;
	
	
	/**
	 * <b>시스템 버전 정보 조회</b>
	 * 
	 * request: phoneType,appType
	 * response : msgCode, msgDesc, version			
	 * 
	 * @param request
	 * @param response 
	 * @return
	 */
	@RequestMapping(value="/system/selectSystemVersion.do")
	public ModelAndView selectSystemVersion(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "file", required = false) MultipartFile file) {
		log.debug("SystemController selectSystemVersion START");
		
		HashMap<String, Object> paramMap = HttpUtil.getParameterMap(request);
		HashMap<String, Object> map = new HashMap<String, Object>();
		try{
			map = mobileSystemService.selectSystemVersion(paramMap);
		}catch(Exception e){
			e.printStackTrace();
		}
		
		log.debug("SystemController selectSystemVersion END");
		return HttpUtil.makeHashToJsonModelAndView(map);
	}
}
