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.Account;
import com.sptg.permissions.api.feigns.fallback.AccountFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * title: AccountFeign
 * package: com.sptg.permissions.api.feigns
 * description: 账号对外服务接口
 *
 *                  
 *                 
 */
@FeignClient(value = "smart-house-permissions",fallbackFactory = AccountFeignFallbackFactory.class)
public interface AccountFeign {

    /**
     * 功能描述: 根据条件分页查询账号列表
     * @param pageBean 查询条件
     * @return ResultBean<Page>
     *                  
     *                       
     */
    @PostMapping(value = "/account/pagingQuery")
    ResultBean<Page> pagingQuery(@RequestBody PageBean<Account,AccountDto> pageBean);

    /**
     * 功能描述: 创建账号
     * @param dto 账号信息
     * @return ResultBean<Account>
     *                  
     *                       
     */
    @PostMapping(value = "/account/add")
    ResultBean<Account> addEntity(@RequestBody AccountDto dto);

    /**
     * 功能描述: 修改账号信息
     * @param dto 账号信息
     * @return ResultBean<Boolean>
     *                  
     *                       
     */
    @PostMapping(value = "/account/update")
    ResultBean<Boolean> updateEnitiy(@RequestBody AccountDto dto);

    /**
     * 功能描述: 开启或禁用账号信息
     * @param dto
     * {
     *     id           :   被禁用的账号Id
     *     isEnable     :   { 1：开启，2：禁用 }
     *     onLineUser   :   当前账号
     * }
     * @return ResultBean<Boolean>
     *                  
     *                       
     */
    @PostMapping(value = "/account/updateIsEnable")
    ResultBean<Boolean> updateIsEnable(@RequestBody AccountDto dto);

    /**
     * 功能描述: 删除账号
     * @param dto 删除条件{ id：必填 }
     * @return ResultBean<Boolean>
     *                  
     *                       
     */
    @PostMapping(value = "/account/delete")
    ResultBean<Boolean> deleteEntity(@RequestBody AccountDto dto);
    
    /**
     * 功能描述:批量删除账号
     * @param dto 删除条件{ ids：必填 }
     * @return ResultBean<Boolean>
     *             
     *                      
     */
    @PostMapping(value = "/account/deleteAccountList")
    ResultBean<Boolean> deleteAccountList(@RequestBody AccountDto dto);

    /**
     * 功能描述: 根据Id获取账号信息
     * @param id 账号Id
     * @return Account
     *                  
     *                       
     */
    @GetMapping(value = "/account/get/{id}")
    Account getById(@PathVariable(value = "id")Long id);

    /**
     * 功能描述: 根据位置查询下属账户数量
     * @param orgPosition 位置信息 必填
     * @return ResultBean<Integer>
     *             
     *                      
     */
    @GetMapping(value = "/account/selectCountByPosition")
    ResultBean<Integer> selectCountByPosition(@RequestParam(value = "orgPosition")String orgPosition);
    /**
     * 功能描述: 开启或禁用账号小程序登录--实施小程序
     * @param dto
     * {
     *     id             :   被禁用的账号Id
     *     isWeChatLogin  :   { 1：开启，2：禁用 }
     * }
     * @return ResultBean<Boolean>
     *               
     *                      
     */
    @PostMapping(value = "/account/updateIsWeChatLogin")
    ResultBean<Boolean> updateIsWeChatLogin(@RequestBody AccountDto dto);
    /**
     * 功能描述: 删除账号的openid--解绑微信
     * @param dto
     * @return ResultBean<Boolean>
     *               
     *                       
     */
    @PostMapping(value = "/account/untiedWeChat")
    ResultBean<Boolean> untiedWeChat(@RequestBody AccountDto dto);

    @PostMapping(value = "/account/updateById")
    ResultBean<Boolean> updateById(@RequestBody Account account);

    @GetMapping(value = "/account/getByOld/{oldId}")
    Account getByOldId(@PathVariable(value = "oldId") String oldId);

    @GetMapping(value = "/account/getByOrgId/{orgId}")
    Account getByOrgId(@PathVariable(value = "orgId") String orgId);

    @GetMapping(value = "/account/addEntityByResidential")
    Boolean addEntityByResidential(@RequestBody Account account);

    @PostMapping(value = "/account/page")
    Page<Account> page(@RequestBody PageBean<Account, AccountDto> pageBean);

    @PostMapping(value = "/account/resetPassword")
    ResultBean<String> resetPassword(@RequestBody AccountDto dto);

    @PostMapping(value = "/account/modifyPassword")
    ResultBean<Boolean> modifyPassword(@RequestBody Account account);

    /**
     * 功能描述: 根据用户手机号获取账号信息
     * @param userMobile 用户手机号
     * @return Account
     *
     *
     */
    @GetMapping(value = "/account/getByUserMobile")
    Account getByUserMobile(@RequestParam(value = "userMobile") String userMobile);
}
