package com.dji.sample.manage.service;

import com.dji.sample.manage.model.dto.UserDTO;
import com.dji.sample.manage.model.dto.UserListDTO;
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
     * @return
     */
    PaginationData<UserListDTO> getUsersByWorkspaceId(long page, long pageSize, String workspaceId);

    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);
}
