package com.madeu.controller.mobile.mobilecustomerservice;

import com.madeu.init.ManagerDraftAction;
import com.madeu.util.HttpUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;

@Slf4j
@Controller
public class MobileCustomerServiceController extends ManagerDraftAction {
    /**
     * 1:1 문의하기 리스트 페이지 이동
     * 페이지 처리 없음
     * request:
     * response : msgCode, msgDesc
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/mobilecustomerservice/selectListCustomerServiceIntro.do")
    public String selectListCustomerServiceIntro(HttpSession session, HttpServletRequest request, Model model) {
        log.debug("MobileCustomerServiceController  selectListCustomerServiceIntro START");

        HashMap<String, Object> paramMap = HttpUtil.getParameterMap(request);
        HashMap<String, Object> map = new HashMap<String, Object>();

        try {
            if (!mobileCheckLogin(session)) {
                return "/mobile/login/login";
            } else {
                paramMap.put("loginUserId", String.valueOf(session.getAttribute("loginUserId")));
            }
        } catch (Exception e) {
            e.printStackTrace();
            return "/mobile/login/login";
        }
        log.debug("MobileCustomerServiceController  selectListCustomerServiceIntro END");
        return "/mobile/customerService/customerService";
    }

    /**
     * 1:1 문의하기 페이지 이동
     * 페이지 처리 없음
     * request:
     * response : msgCode, msgDesc
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/mobilecustomerservice/insertUserInquiryIntro.do")
    public String insertUserInquiryIntro(HttpSession session, HttpServletRequest request, Model model) {
        log.debug("MobileCustomerServiceController  insertUserInquiryIntro START");

        HashMap<String, Object> paramMap = HttpUtil.getParameterMap(request);
        HashMap<String, Object> map = new HashMap<String, Object>();

        try {
            if (!mobileCheckLogin(session)) {
                return "/mobile/login/login";
            } else {
                paramMap.put("loginUserId", String.valueOf(session.getAttribute("loginUserId")));
            }
        } catch (Exception e) {
            e.printStackTrace();
            return "/mobile/login/login";
        }
        log.debug("MobileCustomerServiceController  insertUserInquiryIntro END");
        return "/mobile/userInquiry/insertUserInquiry";
    }

    /**
     * 1:1 문의하기 리스트 페이지 이동
     * 페이지 처리 없음
     * request:
     * response : msgCode, msgDesc
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/mobilecustomerservice/selectListUserInquiryIntro.do")
    public String selectListUserInquiryIntro(HttpSession session, HttpServletRequest request, Model model) {
        log.debug("MobileCustomerServiceController  selectListUserInquiryIntro START");

        HashMap<String, Object> paramMap = HttpUtil.getParameterMap(request);
        HashMap<String, Object> map = new HashMap<String, Object>();

        try {
            if (!mobileCheckLogin(session)) {
                return "/mobile/login/login";
            } else {
                paramMap.put("loginUserId", String.valueOf(session.getAttribute("loginUserId")));
            }
        } catch (Exception e) {
            e.printStackTrace();
            return "/mobile/login/login";
        }
        log.debug("MobileCustomerServiceController  selectListUserInquiryIntro END");
        return "/mobile/userInquiry/selectListUserInquiry";
    }

}
