/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.webapi.remote;

import com.codvision.commoncore.common.ResponseEntity;
import com.codvision.commonfeign.config.OpenFeignConfig;
import com.codvision.webapi.remote.interceptor.BaseRequestInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 用户远程服务
 *
 * @author lingee
 * @date 2023/7/27
 */
@FeignClient(name = "remote-user-sevice", url = "${cvbp.auth.host}/sysUser", configuration = {OpenFeignConfig.class, BaseRequestInterceptor.class})
public interface RemoteUserService {

    /**
     * 获取用户信息列表
     *
     * @param encryption 加密查询条件
     * @return 用户结果
     */
    @PostMapping(value = "/findAll")
    ResponseEntity<String> pageUserList(@RequestParam(value = "encryption") String encryption);

    /**
     * 添加用户
     *
     * @param remoteSysUser 用户信息
     * @return 添加结果
     */
    @PostMapping("/add")
    ResponseEntity<String> add(@RequestBody Map<String, Object> params);

    /**
     * 更新用户
     *
     * @param params 用户信息
     * @return 更新结果
     */
    @PostMapping("/update")
    ResponseEntity<String> update(@RequestBody Map<String, Object> params);

    /**
     * 根据用户id获取用户信息
     *
     * @param encryption 加密后的用户id
     * @return 被加密的用户信息
     */
    @PostMapping(value = "/detail")
    ResponseEntity<String> getByUid(@RequestParam(value = "encryption") String encryption);

    /**
     * 根据登录名获取用户信息
     *
     * @param encryption 加密后的登录名
     * @return
     */
    @PostMapping(value = "/detailByName")
    ResponseEntity<String> getByLoginName(@RequestParam(value = "encryption") String encryption);

}
