package com.madeu.init;

import lombok.extern.slf4j.Slf4j;

import jakarta.servlet.http.HttpSession;

@Slf4j
public class ManagerDraftAction {
	public boolean adminCheckLogin(HttpSession session) throws Exception {
		if (session == null) {
			return false;
		}
		String ntsoftId = (String) session.getAttribute("ntsoftId");
		String ntsoftManagerId = (String) session.getAttribute("ntsoftManagerId");
		String ntsoftManagerName = (String) session.getAttribute("ntsoftManagerName");
		log.debug("======================== MANAGER CHECKLOGIN START =========================");
		log.debug("ntsoftId             : "+ ntsoftId);
		log.debug("ntsoftManagerId      : "+ ntsoftManagerId);
		log.debug("ntsoftManagerName    : "+ ntsoftManagerName);
		log.debug("========================= MANAGER CHECKLOGIN END ==========================");
		if ((ntsoftId == null) || ("".equals(ntsoftId)) || (ntsoftManagerId == null) || ("".equals(ntsoftManagerId))) {
			return false;
		}
		
		return true;
	}
	
	public boolean adminCheckLogin(HttpSession session,String t) throws Exception {
		if (session == null) {
			return false;
		}
		String ntsoftId = (String) session.getAttribute("ntsoftId");
		String ntsoftManagerId = (String) session.getAttribute("ntsoftManagerId");
		String ntsoftManagerName = (String) session.getAttribute("ntsoftManagerName");
		log.debug("======================== MANAGER CHECKLOGIN START =========================");
		log.debug("ntsoftId             : "+ ntsoftId);
		log.debug("ntsoftManagerId      : "+ ntsoftManagerId);
		log.debug("ntsoftManagerName    : "+ ntsoftManagerName);
		log.debug("========================= MANAGER CHECKLOGIN END ==========================");
		if ((ntsoftId == null) || ("".equals(ntsoftId)) || (ntsoftManagerId == null) || ("".equals(ntsoftManagerId))) {
			return false;
		}
		
		return true;
	}

	public boolean webCheckLogin(HttpSession session)throws Exception{
		
		if(session == null){
			return false;
		}
			else{
			String loginMemberId = (String)session.getAttribute("loginMemberId");
			String loginId       = (String)session.getAttribute("loginId");
			String loginName     = (String)session.getAttribute("loginName");
			log.debug("======================== USER CHECKLOGIN START =========================");
			log.debug(" loginMemberId      : "+ loginMemberId);
			log.debug(" loginId            : "+ loginId);
			log.debug(" loginName          : "+ loginName);
			log.debug("======================== USER CHECKLOGIN END ===========================");
			if(null==loginMemberId||("").equals(loginMemberId)){
				return false;
			}
			else{
				return true;
			}
		}
	}

	public boolean mobileCheckLogin(HttpSession session)throws Exception{

		if(session == null){
			return false;
		}
		else{
			String loginUserId 		   = (String)session.getAttribute("loginUserId");
			String mobileLoginId       = (String)session.getAttribute("mobileLoginId");
			String mobileLoginName     = (String)session.getAttribute("mobileLoginName");
			String mobileDeviceUuid    = (String)session.getAttribute("mobileDeviceUuid");
			log.debug("======================== USER CHECKLOGIN START =========================");
			log.debug(" loginUserId       : "+ loginUserId);
			log.debug(" mobileLoginId     : "+ mobileLoginId);
			log.debug(" mobileLoginName   : "+ mobileLoginName);
			log.debug(" mobileDeviceUuid  : "+ mobileDeviceUuid);
			log.debug("======================== USER CHECKLOGIN END ===========================");
			if(null==loginUserId||("").equals(loginUserId)){
				return false;
			}
			else{
				return true;
			}
		}
	}
	
}
