/*
 * Copyright 2011- 2020 SDCIT Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package sgc.portal.com.sym.user.persistence;

import sgc.portal.base.util.EasyHashMap;
import sgc.portal.com.sym.user.model.Login;
import sgc.portal.com.sym.user.model.LoginAs;
import sgc.portal.com.sym.user.model.PasswordChange;
import sgc.portal.com.sym.user.model.SmComLginphto;
import sgc.portal.com.sym.user.model.UserDetails;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 로그인 매퍼 서비스.
 *
 * @author SDCIT
 * @version 1.0.0
 * @since 2020. 7. 5.
 */
@Mapper
public interface LoginMapper {
	/**
	 * 로그인 인증을 위한 Skeleton code로 향후 실제 업무에 맞게 수정 필요. yongsang 2020.07.26
	 *
	 * @param login
	 *            the login
	 * @return the user details
	 */
	UserDetails authenticate(Login login);

	/**
	 * System log in.
	 *
	 * @param userDetails
	 *            the user details
	 */
	void systemLogIn(UserDetails userDetails);

	/**
	 * System log out.
	 *
	 * @param userDetails
	 *            the user details
	 */
	void systemLogOut(UserDetails userDetails);

	/**
     * Save pasword chang update.
     *
     * @param passwordChange the password chang
     */
    void savePasswordChangeUpdate(PasswordChange passwordChange);

	/**
	 * Select password fail count int.
	 *
	 * @param login
	 *            the login
	 * @return the int
	 */
	int selectPasswordFailCount(Login login);

	/**
	 * Password fail reset.
	 *
	 * @param userDetails
	 *            the user details
	 */
	void passwordFailReset(UserDetails userDetails);

	/**
	 * Update fail count.
	 *
	 * @param login
	 *            the login
	 */
	void updateFailCount(Login login);

	/**
	 * Select password expire check string.
	 *
	 * @param login
	 *            the login
	 * @return the string
	 */
	String selectPasswordExpireCheck(Login login);

	/**
	 * Insert password init check int.
	 *
	 * @param login
	 *            the login
	 * @return the int
	 */
	// 비밀번호 초기화
	int insertPasswordInitCheck(Login login);

	/**
	 * 휴대전화번호 조회
	 *
	 * @param login
	 *            the login
	 * @return the String
	 */
	String selectHpno(Login login);

	/**
	 * 임시승인번호 생성
	 *
	 * @return the String
	 */
	String createTmpAproNo();

	/**
	 * 임시승인번호 사용자테이블 업데이트
	 *
	 * @return the String
	 */
	void updateSmComUserForPasswordInit(Login login);

	/**
	 * 임시승인번호 체크 업데이트
	 *
	 * @return the String
	 */
	int checkAuthNo(Login login);

	/**
	 * 사용자 체크
	 *
	 * @return the String
	 */
	int checkAuthCnt(Login login);

	/**
	 * 비밀번호 업데이트
	 *
	 * @return the String
	 */
	void updatePassword(Login login);

	/**
	 * 협력업체 Select password fail count int.
	 *
	 * @param login
	 *            the login
	 * @return the int
	 */
	int asSelectPasswordFailCount(LoginAs login);

	/**
	 * 협력업체 Password fail reset.
	 *
	 * @param userDetails
	 *            the user details
	 */
	void asPasswordFailReset(UserDetails userDetails);

	/**
	 * 협력업체 Update fail count.
	 *
	 * @param login
	 *            the login
	 */
	void asUpdateFailCount(LoginAs login);

	/**
	 * 협력업체 Select password expire check string.
	 *
	 * @param login
	 *            the login
	 * @return the string
	 */
	String asSelectPasswordExpireCheck(LoginAs login);

	/**
	 * 협력업체 로그인 인증을 위한 Skeleton code로 향후 실제 업무에 맞게 수정 필요.
	 *
	 * @param login
	 *            the login
	 * @return the user details
	 */
	UserDetails asAuthenticate(LoginAs login);

	/**
	 * 협력업체 아이디 찾기
	 * 
	 * @author 5364
	 * 
	 * @param login
	 * @return
	 */
	LoginAs asIdFind(LoginAs login);

	/**
	 * 협력업체 비밀번호 찾기 대상 조회
	 * 
	 * @author 5364
	 * @param login
	 * @return
	 */
	Integer asCheckAuthCnt(LoginAs login);

	/**
	 * 협력업체 비밀번호 초기화
	 * 
	 * @author 5364
	 * @param login
	 * @return
	 */
	Integer asUpdatePassword(LoginAs login);

	/**
	 * Save pasword chang update.
	 *
	 * @param passwordChange
	 *            the password chang
	 */
	void asSavePasswordChangeUpdate(PasswordChange passwordChange);

	/**
	 * 협력업체 System log in.
	 *
	 * @param userDetails
	 *            the user details
	 */
	void asSystemLogIn(UserDetails userDetails);

	/**
	 * 협력업체 System log out.
	 *
	 * @param userDetails
	 *            the user details
	 */
	void asSystemLogOut(UserDetails userDetails);

	/**
	 * 그룹웨어 접속 Select password expire check string.
	 *
	 * @param login
	 *            the login
	 * @return the string
	 */
	String insaSelectPassword(Login login);
	
    /**
     * 암호 규칙
     */
	EasyHashMap<String, Object> selectComPasswordPolicyView();
	

}