/*
 * 
 */
package com.bankaudit.service;
 
import java.util.List;

import org.springframework.http.ResponseEntity;

import com.bankaudit.dto.DataTableResponse;
import com.bankaudit.dto.LoginRequest;
import com.bankaudit.dto.UpdateTokenDetailsRequest;
import com.bankaudit.dto.UserRegistrationDto;
import com.bankaudit.model.TestSuperSdmin;
import com.bankaudit.model.User;
import com.bankaudit.util.ServiceStatus;

/**
 * {@link UserService} interface define the CRUD methods for {@link User} class
 * object.
 *
 * @author amit.patel
 * @version 1.0
 */
public interface UserService {

	ResponseEntity<ServiceStatus> login(String domain, LoginRequest loginRequest);

    ResponseEntity<ServiceStatus> logout(String authTokenHeader);

    ResponseEntity<ServiceStatus> updateTokenDetails(String authTokenHeader, UpdateTokenDetailsRequest updateToken);

    ResponseEntity<ServiceStatus> getUserRolesAndDetails(String authTokenHeader);


	/**
	 * This method is use to Gets the user by legal entity code and user id.
	 *
	 * @param legalEntityCode
	 *            specify the legal entity code
	 * @param userId
	 *            specify the user id
	 * @return the user .
	 */
	User getUserByLegalEntityCodeAndUserId(Integer legalEntityCode,String userId);
	
	/**
	 * This method is use to Gets the test super sdmin by username.
	 *
	 * @param username
	 *            specify the username
	 * @return the test super sdmin .
	 */
	TestSuperSdmin getTestSuperSdminByUsername(String username);
	
	/**
	 * This method is use to Update user login timestamp.
	 *
	 * @param legalEntityCode
	 *            specify the legal entity code
	 * @param userId
	 *            specify the user id
	 */
	void updateUserLoginTimestamp(Integer legalEntityCode, String userId);

	/**
	 * This method is use to Creates the user.
	 *
	 * @param userRegistrationDto
	 *            specify the user registration dto
	 */
	void createUser(UserRegistrationDto userRegistrationDto);

	/**
	 * This method is use to Gets the user.
	 *
	 * @param legalEntityCode
	 *            specify the legal entity code
	 * @param userId
	 *            specify the user id
	 * @param search
	 *            specify the search
	 * @param orderColumn
	 *            specify the order column
	 * @param orderDirection
	 *            specify the order direction
	 * @param page
	 *            specify the page
	 * @param size
	 *            specify the size
	 * @return the data table response .
	 */
	DataTableResponse getUser(Integer legalEntityCode,String userId, String search, Integer orderColumn, String orderDirection,
			Integer page, Integer size);

	/**
	 * This method is use to Gets the user.
	 *
	 * @param legalEntityCode
	 *            specify the legal entity code
	 * @param unitCode
	 *            specify the unit code
	 * @param userId
	 *            specify the user id
	 * @param status
	 *            specify the status
	 * @return the list .
	 */
	List<User> getUser(Integer legalEntityCode, String unitCode, String userId,String status);

	/**
	 * This method is use to Update user.
	 *
	 * @param userRegistrationDto
	 *            specify the user registration dto
	 */
	void updateUser(UserRegistrationDto userRegistrationDto);

	/**
	 * This method is use to Checks if is user.
	 *
	 * @param legalEntityCode
	 *            specify the legal entity code
	 * @param userId
	 *            specify the user id
	 * @return the boolean .
	 */
	Boolean isUser(Integer legalEntityCode, String userId);

	List<User> getUserByRoleId(Integer legalEntityCode, String userRoleId);

	List<String> getUploadTables(Integer legalEntityCode);
	
	
	/**
	 * This method is use to Gets the user.
	 *
	 * @param legalEntityCode
	 *            specify the legal entity code
	 * @param unitCode
	 *            specify the unit code
	 * @param userId
	 *            specify the user id
	 * @param status
	 *            specify the status
	 * @return the list .
	 */
	List<User> validateUser(Integer legalEntityCode, String emailId, String userId,String status);
	
	/**
	 * This method is use to Gets the user.
	 *
	 * @param legalEntityCode
	 *            specify the legal entity code
	 * @param unitCode
	 *            specify the unit code
	 * @param status
	 *            specify the status
	 * @return the list .
	 */
	List<User> getAllActiveUsers(Integer legalEntityCode, String unitCode, String status);
	
	Boolean validateUserWithIdandMobile(Integer legalEntityCode, String userId, String mobile1, String emailId, String status);
	
	String updateUserPassword(Integer legalEntityCode, String userId, String pwd);
	
	String getUnitIdforUser(Integer legalEntityCode, String userId);
	
	String getUnitLevelforUser(Integer legalEntityCode, String userId);
	
	void updateBusinessDateBasedOnSysDate(Integer legalEntityCode);
	
	int getUnsuccessfullAttempts(Integer legalEntityCode, String userId);
	
	void updateUnsuccessfullAttempts(Integer legalEntityCode, String userId);
	
	String validateUserOrgetUserStatus(Integer legalEntityCode, String userId, String status);
	
	void deleteUserByID(Integer legalEntityCode, String userId, String makerId);
	
	List<User> getUsersByLevel(Integer legalEntityCode, String levelCode, String status);
	
	List<User> getUsersByLevelAndNotInGrpEntityMapping (Integer legalEntityCode, String levelCode, String status);
	
	List<User> getReportingUsers(Integer legalEntityCode,String unitCode,String userId,String typeOfUser);
	
	List<User> getReportingUsersFromParent(Integer legalEntityCode,String unitCode,String userId,String typeOfUser);
	
	List<User> getImmedieateReportingUsers(Integer legalEntityCode,String unitCode,String userId,String typeOfUser, Boolean onlyParent, Boolean inclusionHO);
	
	List<User> getReportReviewer(Integer legalEntityCode,String unitCode, Boolean onlyParent, Boolean inclusionHO);
	
	List<User> getReportReviewerRO(Integer legalEntityCode,String unitCode, Boolean onlyParent, Boolean inclusionHO);
	
	List<User> getReviewerHO(Integer legalEntityCode,String unitCode);
	
	List<User> getReportReviewerApprover(Integer legalEntityCode,String unitCode, Boolean onlyRO, Boolean onlyHO);
	
	List<User> getAuditorsByAuditId(Integer legalEntityCode,String auditId);
	
	List<User> getReportReviewerROAndAuditors(Integer legalEntityCode,String unitCode, String auditId, Boolean onlyParent, Boolean inclusionHO, String userType);
	
	Boolean isUserBelongsToSameUnitHierarchy(Integer legalEntityCode, String unitCode, String userId, String userUnitCode);
	
	List<User> getFYEOUser(Integer legalEntityCode,String unitCode, Boolean onlyParent, Boolean inclusionHO);
	
	Boolean isUserHavingParticularRole(Integer legalEntityCode, String userId, String role); // To validate if the User having the particular role for VAPT (Broken access control)
	
	Boolean isUserHavingEntitlement(Integer legalEntityCode, String userId, String role, String functionId, String action);
	
	String checkUserSession(Integer legalEntityCode, String userId);
	
	String isFirstLogin(Integer legalEntityCode, String userId);
	
	void insertUserLogin(Integer legalEntityCode, String userId, String unitCode);
	
}
