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.RoleDto;
import com.sptg.permissions.api.entity.Role;
import com.sptg.permissions.api.feigns.fallback.RoleFeignFallbackFactory;
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.util.List;

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


    /**
     * 功能描述: 分页查询角色列表
     * @param pageBean 查询条件
     * @return ResultBean<Page>
     *                  
     *                       
     */
    @PostMapping(value = "/role/pagingQuery")
    ResultBean<Page> pagingQuery(@RequestBody PageBean<Role,RoleDto> pageBean);

    /**
     * 功能描述: 创建角色
     * @param dto 角色信息
     * @return ResultBean<Boolean> { true：成功,false：失败 }
     *                  
     *                       
     */
    @PostMapping(value = "/role/add")
    ResultBean<Boolean> addEntity(@RequestBody RoleDto dto);

    /**
     * 功能描述: 根据Id获取角色
     * @param id 角色Id
     * @return Role
     *                  
     *                       
     */
    @GetMapping(value = "/role/get/{id}")
    Role getById(@PathVariable(value = "id")Long id);

    /**
     * 功能描述: 修改角色信息
     * @param dto 角色信息
     * @return ResultBean<Boolean> { true：成功,false：失败 }
     *                  
     *                       
     */
    @PostMapping(value = "/role/update")
    ResultBean<Boolean> updateEntity(@RequestBody RoleDto dto);

    /**
     * 功能描述: 删除角色信息
     * @param dto 角色信息
     * @return ResultBean<Boolean> { true：成功,false：失败 }
     *                  
     *                       
     */
    @PostMapping(value = "/role/delete")
    ResultBean<Boolean> deleteEntity(@RequestBody RoleDto dto);

    /**
     * 功能描述: 根据机构Id获取角色列表
     * @param orgId 机构Id
     * @return List<Role>
     *                  
     *                       
     */
    @GetMapping(value = "/role/getListByOrgId/{orgId}")
    List<Role> getListByOrgId(@PathVariable(value = "orgId") Long orgId);

    /**
     * 功能描述: 根据账号Id获取角色列表
     * @param accountId 账号Id
     * @return List<Role>
     *                  
     *                       
     */
    @GetMapping(value = "/role/getListByAccountId/{accountId}")
    List<Role> getListByAccountId(@PathVariable(value = "accountId") Long accountId);
}
