package com.sptg.permissions.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.permissions.api.dto.AccountDto;
import com.sptg.permissions.api.entity.DeviceAdminUser;
import com.sptg.permissions.api.feigns.fallback.DeviceAdminUserFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * title: DeviceAdminUserFeign
 * description:
 *
 *                  
 *                
 */
@FeignClient(value = "smart-house-permissions",fallbackFactory = DeviceAdminUserFeignFallbackFactory.class)
public interface DeviceAdminUserFeign {

    /**
     * 根据Id获取设备管理机账号信息
     * @param userId 账号Id
     * @return DeviceAdminUser
     */
    @GetMapping(value = "/xq/device/admin/user/getUserById")
    DeviceAdminUser getUserById(@RequestParam(value = "userId")Long userId);

    /**
     * 分页查询
     * @param pageBean 查询条件
     * @return ResultBean<Page>
     */
    @PostMapping(value = "/xq/device/admin/user/pagingQuery")
    ResultBean<Page> pagingQuery(@RequestBody PageBean<DeviceAdminUser, AccountDto> pageBean);

    /**
     * 新增设备管理机账号
     * @param user 账号信息
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/xq/device/admin/user/addEntity")
    ResultBean<Boolean> addEntity(@RequestBody DeviceAdminUser user);

    /**
     * 管理机账号登陆
     * @param user 账号信息
     * @return ResultBean<DeviceAdminUser>
     */
    @PostMapping(value = "/xq/device/admin/user/login")
    ResultBean<DeviceAdminUser> login(@RequestBody DeviceAdminUser user);
}
