package com.sptg.estate.api.feigns;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.PageBean;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.SimpleUserDto;
import com.sptg.estate.api.dto.UserDto;
import com.sptg.estate.api.entity.User;
import com.sptg.estate.api.feigns.fallback.UserFeignFallbackFactory;
import com.sptg.estate.api.vo.DevicesAccessPushVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * title: UserFeign
 * package: com.sptg.estate.api.feigns
 * description: 住户 服务接口
 *
 *
 *
 */
@FeignClient(value = "smart-house-estate",fallbackFactory = UserFeignFallbackFactory.class)
public interface UserFeign {

    /**
     * 功能描述:住户查询列表
     * @param userDto 住户业务对象（含分页及查询条件）
     * @return ResultBean<Page<User>>
     *
     *
     */
    @PostMapping(value = "/user/showUserList")
    ResultBean<Page<User>> showUserList(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据住户ID查询列表
     * @param userDto 住户业务对象（含分页及查询条件）
     * @return ResultBean<Page<User>>
     *
     *
     */
    @PostMapping(value = "/user/pagingByUserIds")
    ResultBean<Page<User>> pagingByUserIds(@RequestBody UserDto userDto);

    /**
     * 功能描述:新增房间元
     * @param userDto 住户业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/addUser")
    ResultBean<Boolean> addUser(@RequestBody UserDto userDto);

    /**
     * 根据Id 查找住户
     * @param id 必填
     * @return User
     *
     *
     */
    @GetMapping(value = "/user/findUserById/{id}")
    User findUserById(@PathVariable(value = "id") Long id);

    /**
     * 功能描述:编辑住户
     * @param userDto 住户业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/updateUser")
    ResultBean<Boolean> updateUser(@RequestBody UserDto userDto);

    /**
     * 功能描述:删除住户
     * @param userDto 住户业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/deleteUser")
    ResultBean<Boolean> deleteUser(@RequestBody UserDto userDto);

    /**
     * 功能描述:住户放入垃圾箱
     * @param userDto 住户业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/trashOrRecover")
    ResultBean<Boolean> trashOrRecover(@RequestBody UserDto userDto);

    /**
     * 功能描述:批量删除住户
     * @param userDto 住户业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/deleteUserList")
    ResultBean<Boolean> deleteUserList(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据位置查找住户
     * @param userDto 住户业务对象
     * @return ResultBean<User>
     *
     *
     */
    @PostMapping(value = "/user/findListByPosition")
    ResultBean<User> findListByPosition(@RequestBody UserDto userDto);

    /**
     * 功能描述:更新用户审核状态
     * @param userDto 住户业务对象
     * @return  ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/updateUserCheckState")
    ResultBean<Boolean> updateUserCheckState(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据id查询住户名字
     * @param id
     * @return ResultBean<String>
     *
     *
     */
    @GetMapping(value = "/user/getUserNameById/{id}")
    ResultBean<String> getUserNameById(@PathVariable(value = "id") Serializable id);

    /**
     * 功能描述:统计 总住户数(userTotalCount)，上月新增住户数(lastMonthNewUserCount)，租客数(tenantUserCount)，已认证小程序住户数(weiXinUserCount)
     * @param userDto
     * @return ResultBean<Map<String,Object>>
     *
     *
     */
    @PostMapping(value = "/user/statisticsUserCount")
    ResultBean<Map<String,Object>> statisticsUserCount(@RequestBody UserDto userDto);

    /**
     * 功能描述:导入住户
     * @param userDto 住户业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/importUserList")
    ResultBean<Boolean> importUserList(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据位置查询住户数量
     * @param userDto
     * {
     *    orgPosition : 位置信息
     * }
     * @return ResultBean<Map<String,Integer>>
     *
     *
     */
    @PostMapping(value = "/user/getUserAccount")
    ResultBean<Map<String,Integer>> getUserAccount(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据位置查询住户数量
     *
     * @param userDto
     * {
     *    orgPosition : 位置信息
     * }
     * @return int
     *
     *
     */
    @PostMapping(value = "/user/getUserCount")
    int getUserCount(@RequestBody UserDto userDto);

    /**
     * 功能描述:添加或者更新住户人脸图片（并自动下发人脸到全部设备）
     * @param userDto 住户业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/addOrUpdateUserFaceImage")
    ResultBean<Boolean> addOrUpdateUserFaceImage(@RequestBody UserDto userDto);

    /**
     * 功能描述:仅添加或修改（含删除）住户人脸图片（但不下发人脸）
     * @param userDto 住户业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/simpleAddOrUpdateUserFaceImage")
    ResultBean<Boolean> simpleAddOrUpdateUserFaceImage(@RequestBody UserDto userDto);

    /**
     * 功能描述:只执行下发人脸
     * @param userDto 住户业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/sendUserFaceImage")
    ResultBean<Boolean> sendUserFaceImage(@RequestBody UserDto userDto);

    /**
     * 功能描述:批量下发禁用人脸指令
     * @param ids 住户业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/deleteUserFaceImageBatch")
    ResultBean<Boolean> deleteUserFaceImageBatch(@RequestBody List<String> ids);

    /**
     * 功能描述:批量设置并下发人脸
     * @param userDtoList 住户业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/issueUserFaceImageBatch")
    ResultBean<Boolean> issueUserFaceImageBatch(@RequestBody List<SimpleUserDto> userDtoList);

    /**
     * 功能描述:批量下发禁用门禁卡指令
     * @param ids 门禁卡业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/deleteUserCardBatch")
    ResultBean<Boolean> deleteUserCardBatch(@RequestBody List<String> ids);

    /**
     * 功能描述:批量下发启用门禁卡指令
     * @param ids 门禁卡业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/enableUserCardBatch")
    ResultBean<Boolean> enableUserCardBatch(@RequestBody List<String> ids);
     /**
     * 功能描述:人工下发人脸、门禁卡到特定设备上
     * @param devicesAccessPushVO 住户业务传输对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/accessDevicesManualPush")
    ResultBean<Boolean> accessDevicesManualPush(@RequestBody DevicesAccessPushVO devicesAccessPushVO);

    /**
     * 功能描述:根据房间id查询查询房间下的user
     * @param roomIds
     * @return ResultBean<Map<String,Integer>>
     *
     *
     */
    @PostMapping(value = "/user/getListByRoomId")
    List<User> getListByRoomId(@RequestBody List<Long> roomIds);

    /**
     * 功能描述:根据房间id查询查询房间下的user-分页
     * @param userDto
     * @return ResultBean<Map<String,Integer>>
     *
     *
     */
    @PostMapping(value = "/user/pagingByRoomId")
    Page<User> pagingByRoomId(@RequestBody UserDto userDto);


    /**
     * 功能描述:根据机构查询用户不同类型的数量
     * @param userDto
     * @return Map<String,Object>
     *
     *
     */
    @PostMapping(value = "/user/userCountForType")
    Map<String,Object> userCountForType(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据机构查询用户不同来源类型的数量
     * @param userDto
     * @return Map<String,Object>
     *
     *
     */
    @PostMapping(value = "/user/UserCountForCreateType")
    Map<String,Object> userCountForCreateType(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据根据userId查询user
     * @param userIds
     * @return List<User>
     *
     *
     */
    @PostMapping(value = "/user/getListByUserId")
    List<User> getListByUserId(@RequestBody List<Long> userIds);

    /**
     * 功能描述:删除住户,且删除会员与住户的关系（app接口特用）
     * @param userDto{
     *       id         :   住户id,
     *       memberId   :   会员id
     * }
     * @return  ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/deleteUserAndRelationship")
    ResultBean<Boolean> deleteUserAndRelationship(@RequestBody UserDto userDto);

    /**
     * 功能描述:检测房间下的住户名字是否存在
     * @param userDto 住户业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/user/checkByNameAndRoomId")
    ResultBean<Boolean> checkByNameAndRoomId(@RequestBody UserDto userDto);

    /**
     * 根据房间Id和住户名称获取住户
     * @param roomId java.lang.Long
     * @param name java.lang.String
     * @return com.sptg.estate.api.entity.User
     */
    @GetMapping(value = "/user/get/{roomId}/{name}")
    User getByRoomIdAndUserId(@PathVariable(value = "roomId") Long roomId,@PathVariable(value = "name") String name);

    /**
     * 功能描述:根据条件查询住户
     * @param userDto 住户业务对象
     * @return User
     *
     *
     */
    @PostMapping(value = "/user/findUserByCondition")
    User findUserByCondition(@RequestBody UserDto userDto);

    /**
     * 功能描述:根据住户名字查询住户
     * @param userDto 住户业务对象
     * @return
     *
     *
     */
    @PostMapping(value = "/user/findUserByName")
    User findUserByName(@RequestBody UserDto userDto);

    /**
     * 功能描述:查找小区住户总数
     * @param userDto{
     *     residentialId:小区Id 必填
     * }
     * @return int
     *
     *
     */
    @PostMapping(value = "/user/findUserTotalCount")
    Integer findUserTotalCount(@RequestBody UserDto userDto);

    /**
     * 功能描述:分页获取小区住户
     * @param pageBean 查询条件
     * @return  ResultBean<Page<User>>
     *
     *
     */
    @PostMapping(value = "/user/getUserPage")
    ResultBean<Page> getUserPage(@RequestBody PageBean<User, UserDto> pageBean);

    @PostMapping(value = "/user/updateEntity")
    boolean updateEntity(@RequestBody User user);

    /**
     * 根据原数据的Id查询
     * @param oldId java.lang.String
     * @return com.sptg.estate.api.entity.User
     */
    @GetMapping(value = "/user/getByOldId/{oldId}")
    User getByOldId(@PathVariable(value = "oldId")String oldId);

    @GetMapping(value = "/user/getByOldCustomerId/{customerId}/{roomId}")
    User getByOldCustomerId(@PathVariable(value = "customerId")String customerId,@PathVariable(value = "roomId")Long roomId);

    @PostMapping(value = "/user/faceEnable")
    boolean faceEnable(@RequestBody User user);

    @GetMapping(value = "/user/getByRoomIdAndUserMobile/{roomId}/{mobile}")
    User getByRoomIdAndUserMobile(@PathVariable(value = "roomId") Long roomId, @PathVariable(value = "mobile")String mobile);

    @PostMapping(value = "/user/getListByCondition")
    List<User> getListByCondition(@RequestBody UserDto dto);

    @PostMapping(value = "/user/updateUserList")
    boolean updateUserList(@RequestBody List<User> userList);
}
