package com.sptg.ad.api.feigns;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.ad.api.dto.AdPushTaskDto;
import com.sptg.ad.api.entity.AdPushContent;
import com.sptg.ad.api.entity.AdPushTask;
import com.sptg.ad.api.entity.AdPushTaskDetails;
import com.sptg.ad.api.entity.AdPushThresholdValue;
import com.sptg.ad.api.feigns.fallback.AdPushTaskFeignFallbackFactory;
import com.sptg.common.core.beans.ResultBean;
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: AdPushTaskFeign
 * package: com.sptg.ad.api.feigns
 * description: 广告内容-对外接口类
 *
 *               
 *                 
 */
@FeignClient(value = "smart-house-ad",fallbackFactory = AdPushTaskFeignFallbackFactory.class)
public interface AdPushTaskFeign {

    /**
     * 查询广告类型列表(分页)
     * @param adPushTaskDto
     * @return 分页查询结果
     *               
     *                      
     */
    @PostMapping(value = "/showAdPushTaskList")
    ResultBean<Page<AdPushTask>> showAdPushTaskList(AdPushTaskDto adPushTaskDto);

    /**
     * 功能描述:新增/编辑
     * @param adPushTask
     * @return
     *               
     *                      
     */
    @PostMapping(value = "/addAdPushTask")
    ResultBean<Boolean> addAdPushTask(AdPushTask adPushTask);
    /**
     * 功能描述：撤销任务
     * @param  id
     * @return
     *               
     *                      
     */
    @PostMapping(value = "/cancelAdPushTask")
    ResultBean<Boolean> cancelAdPushTask(Long id);
    /**
     * 功能描述:根据id获取广告类容
     * @param id
     * @return
     *               
     *                       
     */
    @PostMapping(value = "/findAdPushTaskById")
    AdPushTask findAdPushTaskById(Long id);
    /**
     * 功能描述: 手动下发任务
     * @param id
     * @return
     *               
     *                       
     */
    @PostMapping(value = "/manuallyIssued")
    ResultBean<Boolean> manuallyIssued(Long id);

    /**
     * 功能描述: 根据下发任务Id和广告编号获取广告内容
     * @param taskId 任务Id
     * @param code 广告编号
     * @return AdPushContent
     *                  
     *                      
     */
    @GetMapping(value = "/getPushContentByTask/{taskId}/{code}")
    AdPushContent getPushContentByTask(@PathVariable(value = "taskId")Long taskId, @PathVariable(value = "code")String code);

    /**
     * 功能描述:根据下发任务Id获取任务详细
     * @param id
     * @return List<AdPushTaskDetails>
     *                
     *                     
     */
    @PostMapping(value = "/getAdPushTaskDetailsByTaskId")
    List<AdPushTaskDetails> getAdPushTaskDetailsByTaskId(@RequestBody Long id);

    /**
     * 功能描述:根据下发任务Id获取广告内容
     * @param id
     * @return  List<AdPushContent>
     *                
     *                     
     */
    @PostMapping(value = "/getAdPushContentsByTaskId")
    List<AdPushContent> getAdPushContentsByTaskId(@RequestBody Long id);
    /**
     * 功能描述:实施小程序--广告一键下发测试
     *  @param   deviceId
     * @return  ResultBean<Boolean>
     *                
     *                      
     */
    @PostMapping(value = "/adIssued")
    ResultBean<Boolean> adIssued(@RequestBody Long deviceId);

    /**
     * 功能描述:获取广告发布阈值
     * @param adPushThresholdValue
     * @return AdPushThresholdValue
     *                
     *                      
     */
    @PostMapping(value = "/getAdPushThresholdValue")
    AdPushThresholdValue getAdPushThresholdValue(@RequestBody AdPushThresholdValue adPushThresholdValue);

    /**
     * 功能描述:保存广告发布阈值
     *
     * @param adPushThresholdValue
     * @return ResultBean<Boolean>
     *                
     *                      
     */
    @PostMapping(value = "/savePushThresholdValue")
    ResultBean<Boolean> savePushThresholdValue(@RequestBody AdPushThresholdValue adPushThresholdValue);

    /**
     * 功能描述:获取当前设备发布的有效广告数量
     * @param deviceId
     * @return com.sptg.common.core.beans.ResultBean<java.lang.Integer>
     *                
     *                     
     */
    @PostMapping(value = "/getValidAdPushCountDevice")
    int getValidAdPushCountDevice(@RequestBody Long deviceId);
}
