package com.style24.admin.biz.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.style24.admin.biz.service.TsaBusinessService;
import com.style24.admin.biz.service.TsaRendererService;
import com.style24.admin.support.controller.TsaBaseController;
import com.style24.admin.support.security.session.TsaSession;
import com.style24.core.support.message.TscMessageByLocale;

import lombok.extern.slf4j.Slf4j;

/**
 * 정산 Controller
 *
 * @author jaewonHo
 * @since 2020. 10. 22
 */
@Controller
@RequestMapping("/settle")
@Slf4j
public class TsaSettleController extends TsaBaseController {

	@Autowired
	private TscMessageByLocale message;

	@Autowired
	private TsaBusinessService businessService;

	@Autowired
	private TsaRendererService rendererService;

	/**
	 * 상품정산 화면
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 22
	 */
	@GetMapping("/goods/form")
	public ModelAndView goodsSettleForm() {
		ModelAndView mav = new ModelAndView();

		// 공급업체
		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd()));

		// 유통구분
		mav.addObject("distributionGbList", rendererService.getCommonCodeList("G065"));

		mav.setViewName("settle/GoodsSettleForm");

		return mav;
	}

	/**
	 * 배송비정산 화면
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 22
	 **/
	@GetMapping("/delivery/fee/form")
	public ModelAndView deliveryFeeSettleForm() {
		ModelAndView mav = new ModelAndView();

		// 공급업체
		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd()));

		// 유통구분
		mav.addObject("distributionGbList", rendererService.getCommonCodeList("G065"));

		mav.setViewName("settle/DeliveryFeeSettleForm");

		return mav;
	}

	/**
	 * 정산확정관리 화면
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 22
	 */
	@GetMapping("/confirm/form")
	public ModelAndView settleConfirmForm() {
		ModelAndView mav = new ModelAndView();

		// 공급업체
		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd()));

		// 유통구분
		mav.addObject("distributionGbList", rendererService.getCommonCodeList("G065"));

		// 은행
		mav.addObject("bankList", rendererService.getCommonCodeList("G940"));

		mav.setViewName("settle/SettleConfirmForm");

		return mav;
	}

	/**
	 * 업체별정산내역 화면
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 22
	 */
	@GetMapping("/supply/company/form")
	public ModelAndView supplyCompanySettleForm() {
		ModelAndView mav = new ModelAndView();

		// 공급업체
		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd()));

		mav.setViewName("settle/SupplyCompanySettleForm");

		return mav;
	}

	/**
	 * PG입금정산 화면
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 22
	 */
	@GetMapping("/pg/deposit/form")
	public ModelAndView paygateDepositForm() {
		ModelAndView mav = new ModelAndView();

		// 공급업체
		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd()));

		// PG구분
		mav.addObject("pgGbList", rendererService.getCommonCodeList("G015"));

		// 결제수단
		mav.addObject("payMeansList", rendererService.getCommonCodeList("G014"));

		mav.setViewName("settle/PgDepositSettleForm");

		return mav;
	}

	/**
	 * 상품권정산 화면
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 22
	 */
	@GetMapping("/giftcard/form")
	public ModelAndView giftcardForm() {
		ModelAndView mav = new ModelAndView();

		// 공급업체
		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(TsaSession.getInfo().getSupplyCompCd()));

		// PG구분
		mav.addObject("pgGbList", rendererService.getCommonCodeList("G015"));

		// 결제수단
		mav.addObject("payMeansList", rendererService.getCommonCodeList("G014"));

		mav.setViewName("settle/GiftcardSettleForm");

		return mav;
	}

}
