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.RoomDto;
import com.sptg.estate.api.entity.Residential;
import com.sptg.estate.api.entity.Room;
import com.sptg.estate.api.feigns.fallback.RoomFeignFallbackFactory;
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: RoomFeign
 * package: com.sptg.estate.api.feigns
 * description: 房间  服务接口
 *
 *
 *
 */
@FeignClient(value = "smart-house-estate",fallbackFactory = RoomFeignFallbackFactory.class)
public interface RoomFeign {

    /**
     * 功能描述:房间列表查询
     * @param roomDto 房间业务对象（含分页及查询条件）
     * @return ResultBean<Page<Room>>
     *
     *
     */
    @PostMapping(value = "/room/showRoomList")
    ResultBean<Page<Room>> showRoomList(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:新增房间元
     * @param roomDto 房间业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/room/addRoom")
    ResultBean<Room> addRoom(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:根据Id查找房间
     * @param id 必填
     * @return Room
     *
     *
     */
    @GetMapping(value = "/room/findRoomById/{id}")
    Room findRoomById(@PathVariable(value = "id")Long id);

    /**
     * 功能描述:编辑房间
     * @param roomDto 房间业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/room/updateRoom")
    ResultBean<Boolean> updateRoom(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:删除房间
     * @param roomDto 房间业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/room/deleteRoom")
    ResultBean<Boolean> deleteRoom(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:房间放入垃圾箱
     * @param roomDto 房间业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/room/trashOrRecover")
    ResultBean<Boolean> trashOrRecover(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:批量删除房间
     * @param roomDto 房间业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/room/deleteRoomList")
    ResultBean<Boolean> deleteRoomList(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:根据位置查找房间
     * @param roomDto 房间业务对象
     * @return ResultBean<Room>
     *
     *
     */
    @PostMapping(value = "/room/findListByPosition")
    ResultBean<Room> findListByPosition(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:导入房间
     * @param roomDto 房间业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/room/importRoomList")
    ResultBean<Boolean> importRoomList(@RequestBody RoomDto roomDto);
    /**
     * 功能描述:查询单元下的房间
     * @param unitId
     * @return
     *
     *
     */
    @PostMapping(value = "/room/getByUnitId")
    ResultBean<Room> getByUnitId(@RequestBody Long unitId);

    /**
     * 功能描述:根据位置查询房间数量
     * @param roomDto
     * {
     *    orgPosition : 位置信息
     * }
     * @return ResultBean<Map<String,Integer>>
     *
     *
     */
    @PostMapping(value = "/room/getRoomAccount")
    ResultBean<Map<String,Integer>> getRoomAccount(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:根据房间id查询房间
     * @param roomIds
     * @return List<Room>
     *
     *
     */
    @PostMapping(value = "/room/getListByRoomId")
    List<Room> getListByRoomId(@RequestBody List<Long> roomIds);

    /**
     * 功能描述:根据房间id查询房间-分页
     * @param roomDto
     * @return Page<Room>
     *
     */
    @PostMapping(value = "/room/pagingByIds")
    Page<Room> pagingByIds(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:根据条件查询房间数量
     * @param roomDto 房间业务对象
     * @return int
     *
     *
     */
    @PostMapping(value = "/room/findRoomByCondition")
    int findRoomByCondition(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:根据房间名称和门牌号查询房间
     * @param roomDto 房间业务对象
     * @return Room
     *
     *
     */
    @PostMapping(value = "/room/findRoomByNameAndNumber")
    Room findRoomByNameAndNumber(@RequestBody RoomDto roomDto);

    /**
     * 功能描述:导入生成房间
     * @param room 房间对象
     * @return Room
     *
     *
     */
    @PostMapping(value = "/room/addRoomByImport")
    Room addRoomByImport(@RequestBody Room room);

    @PostMapping(value = "/room/updateEntity")
    boolean updateEntity(@RequestBody Room room);

    @PostMapping(value = "/room/updateRoomList")
    boolean updateRoomList(@RequestBody List<Room> roomList);

    @PostMapping(value = "/room/getListByLikeName")
    List<Room> getListByLikeName(@RequestBody RoomDto dto);

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

    /**
     * 根据房间编号获取房间信息
     * @param houseNumber java.lang.String
     * @return com.sptg.estate.api.entity.Room
     */
    @GetMapping(value = "/room/getByRoomNumber/{houseNumber}")
    Room getByRoomNumber(@PathVariable(value = "houseNumber") String houseNumber);

    @PostMapping(value = "/room/getListByCondition")
    List<Room> getListByCondition(@RequestBody RoomDto roomDto);

    @GetMapping(value = "/room/getListByUnitId/{unitId}")
    List<Room> getListByUnitId(@PathVariable(value = "unitId") Long unitId);

    @GetMapping(value = "/room/addRoomSync")
    int addRoomSync(@RequestBody Room room);
}
