package com.malk.service.eiam;

import com.malk.server.eiam.EiamApiResponse;

import java.util.List;
import java.util.Map;

/**
 * EIAM DeveloperAPI 账户管理原子接口。
 */
public interface EiamClient_User {

    /**
     * 创建 EIAM 账户。
     *
     * @param accessToken Bearer token
     * @param instanceId IDaaS 实例 ID
     * @param applicationId 应用 ID
     * @param username 账户名
     * @param primaryOrganizationalUnitId 主组织 ID
     * @param bodyExt 可选字段：displayName、password、phoneRegion、phoneNumber、phoneNumberVerified、email、emailVerified、userExternalId、description、passwordInitializationConfig、customFields
     * @return EIAM 原始响应
     * @apiNote https://help.aliyun.com/zh/idaas/eiam/developer-reference/api-eiam-developerapi-2022-02-25-createuser
     */
    EiamApiResponse createUser(String accessToken, String instanceId, String applicationId,
                               String username, String primaryOrganizationalUnitId,
                               Map<String, Object> bodyExt);

    /**
     * 部分更新 EIAM 账户。
     *
     * @param accessToken Bearer token
     * @param instanceId IDaaS 实例 ID
     * @param applicationId 应用 ID
     * @param userId EIAM 账户 ID
     * @param bodyExt 可选字段：username、displayName、phoneRegion、phoneNumber、phoneNumberVerified、email、emailVerified、customFields
     * @return EIAM 原始响应
     * @apiNote https://help.aliyun.com/zh/idaas/eiam/developer-reference/api-eiam-developerapi-2022-02-25-patchuser
     */
    EiamApiResponse patchUser(String accessToken, String instanceId, String applicationId,
                              String userId, Map<String, Object> bodyExt);

    /**
     * 设置 EIAM 账户主组织。
     *
     * @param accessToken Bearer token
     * @param instanceId IDaaS 实例 ID
     * @param applicationId 应用 ID
     * @param userId EIAM 账户 ID
     * @param organizationalUnitId 新主组织 ID
     * @return EIAM 原始响应
     * @apiNote https://help.aliyun.com/zh/idaas/eiam/developer-reference/api-eiam-developerapi-2022-02-25-setuserprimaryorganizationalunit
     */
    EiamApiResponse setUserPrimaryOrganizationalUnit(String accessToken, String instanceId,
                                                     String applicationId, String userId,
                                                     String organizationalUnitId);

    /**
     * 将 EIAM 账户加入多个从属组织，不修改现有主组织和其他从属组织。
     *
     * @param accessToken Bearer token
     * @param instanceId IDaaS 实例 ID
     * @param applicationId 应用 ID
     * @param userId EIAM 账户 ID
     * @param organizationalUnitIds 要追加的组织 ID 列表
     * @return EIAM 原始响应
     * @apiNote https://help.aliyun.com/zh/idaas/eiam/developer-reference/api-eiam-developerapi-2022-02-25-addusertoorganizationalunits
     */
    EiamApiResponse addUserToOrganizationalUnits(String accessToken, String instanceId,
                                                 String applicationId, String userId,
                                                 List<String> organizationalUnitIds);

    /**
     * 删除 EIAM 账户。
     *
     * @param accessToken Bearer token
     * @param instanceId IDaaS 实例 ID
     * @param applicationId 应用 ID
     * @param userId EIAM 账户 ID
     * @return EIAM 原始响应
     * @apiNote https://help.aliyun.com/zh/idaas/eiam/developer-reference/api-eiam-developerapi-2022-02-25-deleteuser
     */
    EiamApiResponse deleteUser(String accessToken, String instanceId, String applicationId,
                               String userId);
}
