package com.dji.sample.manage.service;

import com.dji.sample.manage.model.dto.SignLoginDTO;
import com.dji.sample.manage.model.dto.UserDTO;
import com.dji.sample.manage.model.dto.UserListDTO;
import com.dji.sample.manage.model.entity.UserEntity;
import com.dji.sdk.common.HttpResultResponse;
import com.dji.sdk.common.PaginationData;

import java.util.Optional;

public interface IUserService {

    /**
     * Query user's details based on username.
     * @param username
     * @param workspaceId
     * @return
     */
    HttpResultResponse getUserByUsername(String username, String workspaceId);

    /**
     * Verify the username and password to log in.
     * @param username
     * @param password
     * @param flag
     * @return
     */
    HttpResultResponse userLogin(String username, String password, Integer flag, String gatewaySn);

    HttpResultResponse getToken(String clientId,String username, String password);

    /**
     * Create a user object containing a new token.
     * @param token
     * @return
     */
    Optional<UserDTO> refreshToken(String token);

    /**
     * Query information about all users in a workspace.
     * @param workspaceId   uuid
     * @param searchInfo
     * @return
     */
    PaginationData<UserListDTO> getUsersByWorkspaceId(long page, long pageSize, String workspaceId,String searchInfo);

    HttpResultResponse saveApiUser(String clientId,String username, String password);

    Boolean updateUser(String workspaceId, String userId, UserListDTO user);

    /**
     * 更新用户默认项目工作空间
     * @param newWorkspaceId
     * @param userId
     * @return
     */
    Boolean updateUserWorkspace(String newWorkspaceId, String userId);

    UserEntity getUserByUsername(String username);

    HttpResultResponse userLogin(SignLoginDTO signLoginDTO);

    /**
     * 新增飞行员
     * @param username
     * @param password
     * @param workspaceId
     * @return
     */
    HttpResultResponse savePilotUser(String username, String password,String workspaceId);

    /**
     * 获取密码
     * @param userId
     * @return
     */
    HttpResultResponse getPwd(String userId);
}
