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.RegionAuthorizeDto;
import com.sptg.permissions.api.entity.Organization;
import com.sptg.permissions.api.entity.Region;
import com.sptg.permissions.api.entity.RegionAuthorize;
import com.sptg.permissions.api.feigns.fallback.RegionAuthorizeFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * title: RegionAuthorizeFeign
 * package: com.sptg.permissions.api.feigns
 * description: 区域授权-服务接口
 *
 *                  
 *                 
 */
@FeignClient(name = "smart-house-permissions",fallbackFactory = RegionAuthorizeFeignFallbackFactory.class)
public interface RegionAuthorizeFeign {

    /**
     * 功能描述: 获取某机构的授权区域列表
     *
     * @param position 机构位置
     * @return List<Region>
     *                  
     *                     
     */
    @GetMapping(value = "/region/authorize/getAuthorizeRegionList")
    List<Region> getAuthorizeRegionList(@RequestParam(value = "position") String position);

    /**
     * 功能描述: 获取某用户的授权区域列表（包括此机构的下级）
     * @param dto
     * {
     *  orgPosition     :   必填,用户所属的机构位置,用来做筛选
     *  groupBy         :   必填,分组条件{ 1：省，2：市，3：区 }
     *  pid             :   选填
     * }
     * @return List<Region>
     *                  
     *                       
     */
    @PostMapping(value = "/region/authorize/getAuthorizeRegion")
    List<Region> getAuthorizeRegion(@RequestBody RegionAuthorizeDto dto);

    /**
     * 功能描述: 分页查询授权列表
     * @param pageBean 查询条件
     * @return List<RegionAuthorize>
     *                  
     *                      
     */
    @PostMapping(value = "/region/authorize/pagingQuery")
    Page<RegionAuthorize> pagingQuery(@RequestBody PageBean<RegionAuthorize,RegionAuthorizeDto> pageBean);

    /**
     * 功能描述: 批量添加
     *
     * @param dto {
     *            orgPosition :   必填
     *            orgIdList   :   必填，授权的小区Id列表
     *            createAccountId     :   创建人Id
     *            }
     * @return ResultBean<Boolean>
     *                  
     *                      
     */
    @PostMapping(value = "/region/authorize/batchAdd")
    ResultBean<Boolean> batchAdd(@RequestBody RegionAuthorizeDto dto);

    /**
     * 功能描述: 批量添加
     *
     * @param dto {
     *            orgPosition :   必填
     *            orgIdList   :   必填，授权的小区Id列表
     *            }
     * @return ResultBean<Boolean>
     *                  
     *                      
     */
    @PostMapping(value = "/region/authorize/batchDelete")
    ResultBean<Boolean> batchDelete(@RequestBody RegionAuthorizeDto dto);

    /**
     * 功能描述: 查询授权小区和上级机构列表
     * @param dto
     * {
     *      orgPosition     :   必填,用户所属的机构位置,用来做筛选
     *      isSelectParent  :   选填,是否查询父级
     *      pid             :   选填,指定某机构的的数据
     * }
     * @return List<Organization>
     *                  
     *                       
     */
    @PostMapping(value = "/region/authorize/getAuthorizeOrgList")
    List<Organization> getAuthorizeOrgList(@RequestBody RegionAuthorizeDto dto);

    /**
     * 功能描述: 查询授权小区和上级机构列表(排除关联设备授权的小区条件)
     * @param dto
     * {
     *      orgPosition     :   必填,用户所属的机构位置,用来做筛选
     *      pid             :   选填,指定某机构的的数据
     * }
     * @return List<Organization>
     *                
     *                     
     */
    @PostMapping(value = "/region/authorize/getAuthorizeOrgListTwo")
    List<Organization> getAuthorizeOrgListTwo(@RequestBody RegionAuthorizeDto dto);

    /**
     * 功能描述: 分页查询授权小区列表
     * @param pageBean 查询条件
     * @return Page<Organization>
     *                  
     *                       
     */
    @PostMapping(value = "/region/authorize/pagingQueryAuthorizeOrg")
    Page<Organization> pagingQueryAuthorizeOrg(@RequestBody PageBean<RegionAuthorize,RegionAuthorizeDto> pageBean);
}
