package com.style24.scm.biz.web;

import java.util.Collection;

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.persistence.domain.Notice;
import com.style24.scm.biz.service.TssNoticeService;
import com.style24.scm.support.controller.TssBaseController;

import lombok.extern.slf4j.Slf4j;

/**
 * 공지사항 Controller
 *
 * @author gagamel
 * @since 2020. 12. 29
 */
@Controller
@RequestMapping("/board")
@Slf4j
public class TssBoardController extends TssBaseController {

	@Autowired
	private TssNoticeService noticeService;

	/**
	 * 공지사항 팝업 화면
	 * @param noticeType - 공지유형(10:사이트공지, 20:내부공지)
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 30
	 */
	@GetMapping("/notice/popup/form")
	public ModelAndView noticePopupForm() {
		ModelAndView mav = new ModelAndView();

		// 공지사항 목록
		Collection<Notice> noticeList = noticeService.getNoticePopupList();
		mav.addObject("noticeCnt", noticeList.size());
		mav.addObject("noticeList", noticeList);

		mav.setViewName("board/NoticePopupForm");

		return mav;
	}

}
