package com.sptg.estate.api.feigns;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.BuildingBatchAdd;
import com.sptg.estate.api.dto.BuildingDto;
import com.sptg.estate.api.entity.Building;
import com.sptg.estate.api.feigns.fallback.BuildingFeignFallbackFactory;
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;
import java.util.Map;

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

    /**
     * 功能描述:楼栋列表查询
     * @param buildingDto 楼栋业务对象（含分页及查询条件）
     * @return ResultBean<Page<Building>>
     *
     *
     */
    @PostMapping(value = "/building/showBuildingList")
    ResultBean<Page<Building>> showBuildingList(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:新增楼栋元
     * @param buildingDto 楼栋业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/building/addBuilding")
    ResultBean<Building> addBuilding(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:根据Id查找楼栋
     * @param id 必填
     * @return Building
     *
     *
     */
    @GetMapping(value = "/building/findBuildingById/{id}")
    Building findBuildingById(@PathVariable(value = "id") Long id);

    /**
     * 功能描述:编辑楼栋
     * @param buildingDto 楼栋业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/building/updateBuilding")
    ResultBean<Boolean> updateBuilding(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:删除楼栋
     * @param buildingDto 楼栋业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/building/deleteBuilding")
    ResultBean<Boolean> deleteBuilding(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:楼栋放入垃圾箱
     * @param buildingDto 楼栋业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/building/trashOrRecover")
    ResultBean<Boolean> trashOrRecover(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:批量删除楼栋
     * @param buildingDto 楼栋业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/building/deleteBuildingList")
    ResultBean<Boolean> deleteBuildingList(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:根据位置查找楼栋
     * @param buildingDto 楼栋业务对象
     * @return ResultBean<Building>
     *
     *
     */
    @PostMapping(value = "/building/findListByPosition")
    ResultBean<Building> findListByPosition(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:导入楼栋
     * @param buildingDto 楼栋业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/building/importBuildingList")
    ResultBean<Boolean> importBuildingList(@RequestBody BuildingDto buildingDto);
    /**
     * 功能描述:查询单元下的楼栋
     * @param unitId
     * @return
     *
     *
     */
    @PostMapping(value = "/building/getByUnitId")
    ResultBean<Building> getByUnitId(@RequestBody Long unitId);

    /**
     * 功能描述:根据位置查询楼栋数量
     * @param buildingDto
     * {
     *    orgPosition : 位置信息
     * }
     * @return ResultBean<Map<String,Integer>>
     *
     *
     */
    @PostMapping(value = "/building/getBuildingAccount")
    ResultBean<Map<String,Integer>> getBuildingAccount(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:根据楼栋id查询楼栋
     * @param buildingIds
     * @return List<Building>
     *
     *
     */
    @PostMapping(value = "/building/getListByBuildingId")
    List<Building> getListByBuildingId(@RequestBody List<Long> buildingIds);

    /**
     * 功能描述:根据楼栋id查询楼栋-分页
     * @param buildingDto
     * @return Page<Building>
     *
     */
    @PostMapping(value = "/building/pagingByIds")
    Page<Building> pagingByIds(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:根据条件查询楼栋数量
     * @param buildingDto 楼栋业务对象
     * @return int
     *
     *
     */
    @PostMapping(value = "/building/findBuildingByCondition")
    int findBuildingByCondition(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:根据楼栋名称和门牌号查询楼栋
     * @param buildingDto 楼栋业务对象
     * @return Building
     *
     *
     */
    @PostMapping(value = "/building/findBuildingByNameAndNumber")
    Building findBuildingByNameAndNumber(@RequestBody BuildingDto buildingDto);

    /**
     * 功能描述:导入生成楼栋
     * @param building 楼栋对象
     * @return Building
     *
     *
     */
    @PostMapping(value = "/building/addBuildingByImport")
    Building addBuildingByImport(@RequestBody Building building);

    @PostMapping(value = "/building/updateEntity")
    boolean updateEntity(@RequestBody Building building);

    @PostMapping(value = "/building/updateBuildingList")
    boolean updateBuildingList(@RequestBody List<Building> buildingList);

    @PostMapping(value = "/building/getListByLikeName")
    List<Building> getListByLikeName(@RequestBody BuildingDto dto);

    /**
     * 根据原数据的Id获取楼栋信息
     * @param oldId java.lang.String
     * @return com.sptg.estate.api.entity.Building
     */
    @GetMapping(value = "/building/getByOldId/{oldId}")
    Building getByOldId(@PathVariable(value = "oldId") String oldId);

    /**
     * 根据楼栋编号获取楼栋信息
     * @param houseNumber java.lang.String
     * @return com.sptg.estate.api.entity.Building
     */
    @GetMapping(value = "/building/getByBuildingNumber/{houseNumber}")
    Building getByBuildingNumber(@PathVariable(value = "houseNumber") String houseNumber);

    @PostMapping(value = "/building/getListByCondition")
    List<Building> getListByCondition(@RequestBody BuildingDto buildingDto);

    @PostMapping(value = "/building/addBuildingBatch")
    boolean addBuildingBatch(@RequestBody BuildingBatchAdd batchAdd);
}
