package com.tzld.piaoquan.api.controller;

import com.tzld.piaoquan.api.model.bo.BucketDataParam;
import com.tzld.piaoquan.api.model.bo.MsgData;
import com.tzld.piaoquan.api.model.bo.ReplyBucketData;
import com.tzld.piaoquan.api.model.bo.bucketDataGenerateParam;
import com.tzld.piaoquan.api.model.vo.VideoCharacteristicVO;
import com.tzld.piaoquan.api.service.CgiReplyService;
import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/cgi/reply")
@Slf4j
public class CgiReplyController {

    @Autowired
    private CgiReplyService cgiReplyService;

    @PostMapping("/bucketData")
    public CommonResponse<ReplyBucketData> getBucketData(@RequestBody BucketDataParam bucketDataParam) {
        ReplyBucketData replyBucketData = cgiReplyService.getRgiReplyData(bucketDataParam);
        return CommonResponse.success(replyBucketData);
    }

    @PostMapping("/bucketDataGenerate")
    public CommonResponse<MsgData> bucketDataGenerate(@RequestBody bucketDataGenerateParam param) {
        MsgData data = cgiReplyService.bucketDataGenerate(param);
        return CommonResponse.success(data);
    }

    @GetMapping("/getVideoCharacteristic")
    public CommonResponse<VideoCharacteristicVO> getVideoCharacteristicByRootSourceId(@RequestParam String rootSourceId) {
        return CommonResponse.success(cgiReplyService.getVideoCharacteristicByRootSourceId(rootSourceId));
    }

    @GetMapping("/checkExistRootSourceId")
    public CommonResponse<Boolean> checkExistRootSourceId(@RequestParam String rootSourceId) {
        return CommonResponse.success(cgiReplyService.checkExistRootSourceId(rootSourceId));
    }
}
