/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved. <a>http://www.crunii.com</a>
 */
package com.crunii.micro.service.sysmgr.service;

import com.crunii.micro.domain.dto.LoginInfoDto;
import com.crunii.micro.common.dto.Result;
import com.crunii.micro.domain.dto.LoginInfoDto;
import com.crunii.micro.domain.dto.Worker;
import com.crunii.micro.domain.entity.main.TsmWorker;
import com.crunii.micro.feign.client.dto.*;
import com.crunii.micro.service.sysmgr.dto.sysmgr.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author 田平 create 2018年10月31日上午10:20:41
 */
public interface LoginService {

	public void storeCaptchaKeyId(String key, String code);

	public String removeCaptchaKeyId(String key);

	public Worker doLogin(HttpServletRequest request,String username, String password, String scope, String callUrl);

	Worker getUserInfo(Worker currWorker);

	public void doLogout(String token);

	public Worker doRefreshToken(Worker worker);

	public void clearPwdError(int loginId);

	/**
	 * 找回密码
	 * @param phoneNum 手机号
	 * @param shortMsgCode 短信验证码
	 * @return secretKey
	 */
    String retrievePwd(String phoneNum, String shortMsgCode);

	/**
	 * 修改密码
	 * @param secretKey secretKey
	 * @param newPwd 新密码
	 * @return success/false
	 */
	String updatePwd(String secretKey, String newPwd);

	/**
	 * 获取短信验证码
	 * @param smsCodeSend 发送短信验证
	 * @return code
	 */
	String getPhoneCode(SmsCodeSend smsCodeSend);

	/**
	 * 获取手机验证码-不需要图文验证
	 * @param smsCodeNoTextDTO
	 * @return
	 */
	String getPhoneCodeNoText(SmsCodeNoTextDTO smsCodeNoTextDTO);

	/**
	 * 短信登录
	 * @param loginPhoneDto 登录参数
	 * @param callUrl url
	 * @param isRegister 是否注册
	 * @return worker
	 */
	Worker loginMobile(HttpServletRequest request,LoginPhoneDto loginPhoneDto,String callUrl,boolean isRegister);


	/**
	 * app面容登录
	 * @param request
	 * @param loginCheckoutFaceDTO
	 * @return
	 */
	Worker loginFace(HttpServletRequest request, LoginCheckoutFaceDTO loginCheckoutFaceDTO);

	/**
	 * 验证更换手机操作
	 * @param dto
	 * @return
	 */
	Result<String> verificationMobile(SetUserPhoneDTO dto);

	/**
	 * 更换手机号
	 * @param dto
	 * @return
	 */
	Result<String> setUserPhone(SetUserPhoneDTO dto);

	/**
	 * 用户注销
	 * @param worker
	 * @return
	 */
	Result<String> deleteUserLogout(Worker worker);

	void saveLoginLog();

	/**
	 * 创建用户并登录
	 * @param request 请求
	 * @param loginWorkerC loginWorkerC
	 * @param callUrl 调用url
	 * @return data
	 */
	Worker createWorkerAndLogin(HttpServletRequest request, LoginWorkerC loginWorkerC, String callUrl);

	/**
	 * 上传头像
	 * @param file 文件
	 * @param request 请求
	 * @return data
	 */
	FileVo uploadHeadPic(MultipartFile file,HttpServletRequest request);

	/**
	 * 用户通过微信公众号h5跳转登录
	 * @param dto
	 * @return
	 */
    Worker wechatDoLogin(HttpServletRequest request, WechatLoginDto dto, TsmWorker worker, boolean manualLogin);

    IRSWorkerVo getUserInfoIRS(String loginId);

	Worker loginExternalMobile(HttpServletRequest request, LoginInfoDto loginInfoDto, String callUrl, boolean b) throws IOException;

	Result doRefreshAccountId(LoginPhoneDto loginPhoneDto);
}
