package com.sptg.statistics.biz.controller;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.statistics.api.dto.StatisticsAdPushCountDto;
import com.sptg.statistics.api.entity.StatisticsAdPushCount;
import com.sptg.statistics.api.feigns.StatisticsAdPushCountFeign;
import com.sptg.statistics.biz.service.StatisticsAdPushCountServiceInterface;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * title: StatisticsAdPushController
 * package: com.sptg.statistics.biz.controller
 * description: 统计广告发布数量-控制器(这里不是投放量)
 *
 *                
 *                 
 */
@RestController
@AllArgsConstructor
public class StatisticsAdPushCountController implements StatisticsAdPushCountFeign {

    private final StatisticsAdPushCountServiceInterface statisticsAdPushCountServiceInterface;

    @Override
    @PostMapping(value = "/statistics/statisticsAdPushCount/getStatisticsAdPushCountByTaskId")
    public StatisticsAdPushCount getStatisticsAdPushCountByTaskId(@RequestBody StatisticsAdPushCountDto statisticsAdPushCountDto) {
        StatisticsAdPushCount statisticsAdPushCount = statisticsAdPushCountServiceInterface.getStatisticsAdPushCountByTaskId(statisticsAdPushCountDto);
        return statisticsAdPushCount;
    }

    @Override
    @PostMapping(value = "/statistics/statisticsAdPushCount/addAdPushCount")
    public ResultBean<Boolean> addAdPushCount(@RequestBody StatisticsAdPushCountDto statisticsAdPushCountDto) {
        boolean insert = statisticsAdPushCountServiceInterface.insert(statisticsAdPushCountDto);
        return new ResultBean<>(ResultEnum.SUCCESS,insert);
    }

    @Override
    @PostMapping(value = "/statistics/statisticsAdPushCount/getAdPushCount")
    public ResultBean<Long> getAdPushCount(@RequestBody StatisticsAdPushCountDto statisticsAdPushCountDto) {
        long adPushCount = statisticsAdPushCountServiceInterface.getAdPushCount(statisticsAdPushCountDto);
        return new ResultBean<>(ResultEnum.SUCCESS,adPushCount);
    }

    @Override
    @PostMapping(value = "/statistics/statisticsAdPushCount/updateAdPushState")
    public ResultBean<Boolean> updateAdPushState(@RequestBody StatisticsAdPushCountDto statisticsAdPushCountDto) {
        boolean result = statisticsAdPushCountServiceInterface.updateAdPushState(statisticsAdPushCountDto);
        return new ResultBean<>(ResultEnum.SUCCESS,result);
    }
}
