package cn.iselab.mooctest.user.web.logic;

import cn.iselab.mooctest.rpc.user.data.UserDTO;
import cn.iselab.mooctest.user.constants.ResponseStatus;
import cn.iselab.mooctest.user.data.ResponseResult;
import cn.iselab.mooctest.user.model.OperationRecord;
import cn.iselab.mooctest.user.web.data.BankAccountInfoVO;
import cn.iselab.mooctest.user.web.data.UserVO;
import cn.iselab.mooctest.user.web.exception.ConfigurationNotExistException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * @author sean
 * @date 2018-03-04.
 */
public interface UserLogic {

    UserDTO getUserByEmail(String s);

    UserDTO getUserByMobile(String s);

    UserDTO getUserById(Long userId);

    Boolean checkPassword(UserDTO userDTO);

    ResponseResult<UserDTO> checkPWD(UserDTO userDTO);

    UserDTO save(UserDTO userDTO);

    UserDTO updateUser(UserDTO userDTO);

    List<UserDTO> getUserByFuzzyName(UserDTO userDTO);

    List<UserDTO> getUserByFuzzyEmail(UserDTO userDTO);

    List<UserDTO> getUserByFuzzyNameOrEmail(UserDTO userDTO);

    List<UserDTO> findAll(List<Long> userIds);

    List<UserDTO> findByEmails(List<String> emails);

    ResponseResult<UserDTO> registerAccount(UserVO userVO);

    ResponseResult<String> sendVerifyEmail(UserDTO userDTO);

    ResponseResult<String> sendMobileVerfication(UserDTO userDTO);

    ResponseResult<UserDTO> loginByMobile(UserVO userVO);

    ResponseResult<UserVO> checkVerifyCode(UserVO userVO, String type);

    ResponseResult<UserVO> resetPassword(UserVO userVO);

    ResponseResult<UserVO> updateUserPassword(UserVO userVO, HttpServletRequest request);

    ResponseResult<UserVO> updateUserPasswordNew(UserVO userVO, HttpServletRequest request);

    ResponseResult<UserVO> updateUserEmail(UserVO userVO, HttpServletRequest request);

    ResponseResult<UserVO> updateUserMobile(UserVO userVO, HttpServletRequest request);

    ResponseResult<UserVO> verifyOldMobile(UserVO userVO, HttpServletRequest request);

    ResponseResult<Object> setBankInfo(BankAccountInfoVO infoVO, HttpServletRequest request);

    void saveRedirectUrl(String redirect, HttpServletRequest request);

    void recordLoginAction(HttpServletRequest request, Long userId, String resource);

    void recordLogoutAction(HttpServletRequest request, Long userId, String resource);

    void recordUserOperation(HttpServletRequest request, Long userId, String operation, String resource);

    void recordUserOperation(OperationRecord record);

    void recordUserOperation(String ip, Long userId, String operation, String resource);

    Boolean isLogin(HttpServletRequest request);

    String getPlatformName() throws ConfigurationNotExistException;

    Map<String, String> getConfiguration();
}
