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.GuestAuthorizeDto;
import com.sptg.estate.api.entity.GuestAuthorize;
import com.sptg.estate.api.feigns.fallback.GuestAuthorizeFeignFallbackFactory;
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: GuestAuthorizeFeign
 * package: com.sptg.estate.api.feigns
 * description:访客授权记录 服务接口
 *
 *
 *
 */
@FeignClient(value = "smart-house-estate",fallbackFactory = GuestAuthorizeFeignFallbackFactory.class)
public interface GuestAuthorizeFeign {

    /**
     * 功能描述:访客授权记录查询列表
     * @param guestAuthorizeDto 访客授权记录业务对象（含分页及查询条件）
     * @return Page<GuestAuthorize>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/showGuestAuthorizeList")
    Page<GuestAuthorize> showGuestAuthorizeList(@RequestBody GuestAuthorizeDto guestAuthorizeDto);

    /**
     * 功能描述:查询有效的访客密码列表
     * @param guestAuthorizeDto 访客授权记录业务对象（含分页及查询条件）
     * @return Page<GuestAuthorize>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/showEffectiveGuestAuthorizeList")
    Page<GuestAuthorize> showEffectiveGuestAuthorizeList(@RequestBody GuestAuthorizeDto guestAuthorizeDto);

    /**
     * 功能描述:新增访客授权记录
     * @param guestAuthorize 访客授权记录业务对象
     * @return ResultBean<GuestAuthorize>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/addGuestAuthorize")
    ResultBean<GuestAuthorize> addGuestAuthorize(@RequestBody GuestAuthorize guestAuthorize);

    /**
     * 根据Id 查找访客授权记录
     * @param id 必填
     * @return AccessRecords
     *
     *
     */
    @GetMapping(value = "/guestAuthorize/findGuestAuthorizeById/{id}")
    GuestAuthorize findGuestAuthorizeById(@PathVariable(value = "id") Long id);

    /**
     * 功能描述:编辑访客授权记录
     * @param guestAuthorizeDto 访客授权记录业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/updateGuestAuthorize")
    ResultBean<Boolean> updateGuestAuthorize(@RequestBody GuestAuthorizeDto guestAuthorizeDto);

    /**
     * 功能描述:删除访客授权记录
     * @param guestAuthorizeDto 访客授权记录业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/deleteGuestAuthorize")
    ResultBean<Boolean> deleteGuestAuthorize(@RequestBody GuestAuthorizeDto guestAuthorizeDto);

    /**
     * 功能描述:更新访客授权记录密码状态
     * @param guestAuthorize 访客授权记录业务对象
     * @return ResultBean<Boolean>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/updateGuestAuthorizeEnableType")
    ResultBean<Boolean> updateGuestAuthorizeEnableType(@RequestBody GuestAuthorize guestAuthorize);

    /**
     * 功能描述:根据机构位置查询访客数量
     * @param guestAuthorizeDto
     * {
     *    orgPosition : 位置信息
     * }
     * @return long
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/getGuestCount")
    long getGuestCount(@RequestBody GuestAuthorizeDto guestAuthorizeDto);

    /**
     * 功能描述:按时间分组统计某时间访客人数
     * @param guestAuthorizeDto
     * {
     *     selectBeginDate 查询开始时间
     *     selectEndDate 查询截止时间
     *     createDate 查询时间
     *     groupType  数据分组类型  0 按时  1按日 2按周  3按月
     *     orgPosition 机构位置
     * }
     * @return  List<Map<String, Object>>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/guestAuthorizeCountListForGroupType")
    List<Map<String, Object>> guestAuthorizeCountListForGroupType(@RequestBody GuestAuthorizeDto guestAuthorizeDto);

    /**
     * 功能描述:根据userId查询对应密码记录
     * @param userIds
     * @return ResultBean<GuestAuthorize>
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/getListByUserId")
    ResultBean<GuestAuthorize> getListByUserId(@RequestBody List<Long> userIds);

    /**
     * 功能描述:获取当天小区的访客量
     * @param guestAuthorizeDto{
     *         residentialId：小区Id必填
     * }
     * @return int
     *
     *
     */
    @PostMapping(value = "/guestAuthorize/getGuestAuthorizeCountByDay")
    Integer getGuestAuthorizeCountByDay(@RequestBody GuestAuthorizeDto guestAuthorizeDto);

    /**
     * 根据条件筛选数据
     * @param guestAuthorize
     * @return
     */
    @PostMapping(value = "/guestAuthorize/getGuestAuthorizeByCondition")
    GuestAuthorize getGuestAuthorizeByCondition(@RequestBody GuestAuthorize guestAuthorize);
}
