package cn.reghao.tnb.content.app.vod.controller;

import cn.reghao.tnb.common.web.WebResult;
import cn.reghao.tnb.content.api.dto.spider.CrawledVideo;
import cn.reghao.tnb.content.app.vod.service.CrawledDataService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author reghao
 * @date 2023-11-25 14:50:15
 */
@Tag(name = "爬取数据提交接口")
@RestController
@RequestMapping("/api/content/post/video")
public class CrawledDataController {
    private final CrawledDataService crawledDataService;

    public CrawledDataController(CrawledDataService crawledDataService) {
        this.crawledDataService = crawledDataService;
    }

    @Operation(summary = "添加 bili 视频稿件", description = "N")
    @PostMapping("/bili")
    public String addBiliVideoPost(@RequestBody @Validated CrawledVideo crawledVideo) {
        crawledDataService.publishVideo(crawledVideo);
        return WebResult.success();
    }

    @Operation(summary = "添加 bili 视频评论", description = "N")
    @PostMapping("/bili/comment")
    public String addBiliVideoComment(/*@RequestBody CommentSbtDto commentSbtDto*/) {
        //commentService.saveBiliComment(commentSbtDto);
        return WebResult.success();
    }

    @Operation(summary = "添加 bili 视频数据", description = "N")
    @PostMapping("/bili/statistic")
    public String addBiliVideoStatistic(@RequestBody @Validated CrawledVideo crawledVideo) {
        crawledDataService.updateVideoStatistic(crawledVideo);
        return WebResult.success();
    }
}
