package com.madeu.dao.web.webhospitalholiday;

import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import jakarta.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class WebHospitalHolidaySqlMapDAO extends SqlSessionDaoSupport{

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@PostConstruct
	void init() {
		setSqlSessionTemplate(sqlSessionTemplate);
	}
	
	/**
	 * 병원 휴일 정보 리스트 조회 (List)
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectListHospitalHoliday(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHospitalHolidaySqlMapDAO selectListHospitalHoliday START");
		String sqlId = "WebHospitalHoliday.selectListHospitalHoliday";
		logger.debug("WebHospitalHolidaySqlMapDAO selectListHospitalHoliday END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 병원 휴일 등록 여부 조회
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException 
	 */
	public List<Map<String, Object>> selectHospitalHolidayDate(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHospitalHolidaySqlMapDAO selectHospitalHolidayDate START");
		String sqlId = "WebHospitalHoliday.selectHospitalHolidayDate";
		logger.debug("WebHospitalHolidaySqlMapDAO selectHospitalHolidayDate END");
		return getSqlSession().selectList(sqlId, paramMap);
	}
	
	/**
	 * 병원 휴일 정보 등록
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int insertHospitalHoliday(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHospitalHolidaySqlMapDAO insertHospitalHoliday START");
		String sqlId = "WebHospitalHoliday.insertHospitalHoliday";
		logger.debug("WebHospitalHolidaySqlMapDAO insertHospitalHoliday END");
		return getSqlSession().insert(sqlId, paramMap);
	}
	
	/**
	 * 병원 휴일 정보 수정
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int updateHospitalHoliday(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHospitalHolidaySqlMapDAO updateHospitalHoliday START");
		String sqlId = "WebHospitalHoliday.updateHospitalHoliday";
		logger.debug("WebHospitalHolidaySqlMapDAO updateHospitalHoliday END");
		return getSqlSession().update(sqlId, paramMap);
	}

	/**
	 * 병원 휴일 정보 삭제
	 * 
	 * @param Map
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteHospitalHoliday(HashMap<String, Object> paramMap)
			throws DataAccessException {
		logger.debug("WebHospitalHolidaySqlMapDAO deleteHospitalHoliday START");
		String sqlId = "WebHospitalHoliday.deleteHospitalHoliday";
		logger.debug("WebHospitalHolidaySqlMapDAO deleteHospitalHoliday END");
		return getSqlSession().update(sqlId, paramMap);
	}
}
