package com.tzld.piaoquan.api.controller.contentplatform;

import com.tzld.piaoquan.api.annotation.JwtIgnore;
import com.tzld.piaoquan.api.annotation.RequireSign;
import com.tzld.piaoquan.api.model.param.contentplatform.DeleteVideoParam;
import com.tzld.piaoquan.api.model.param.contentplatform.PublishVideoParam;
import com.tzld.piaoquan.api.model.param.contentplatform.UploadVideoListParam;
import com.tzld.piaoquan.api.model.param.contentplatform.VideoAuditCallBackParam;
import com.tzld.piaoquan.api.model.vo.contentplatform.UploadVideoItemVO;
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformUploadContentService;
import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
import com.tzld.piaoquan.growth.common.utils.page.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/contentPlatform/uploadContent")
@CrossOrigin(origins = "*")
public class ContentPlatformUploadContentController {

    @Autowired
    ContentPlatformUploadContentService service;

    @ApiOperation(value = "发布视频")
    @PostMapping("/publishVideo")
    @RequireSign
    public CommonResponse<UploadVideoItemVO> publishVideo(@RequestBody PublishVideoParam param) {
        return CommonResponse.success(service.publishVideo(param));
    }

    @ApiOperation(value = "修改视频")
    @PostMapping("/updateVideo")
    @RequireSign
    public CommonResponse<UploadVideoItemVO> updateVideo(@RequestBody PublishVideoParam param) {
        return CommonResponse.success(service.updateVideo(param));
    }

    @ApiOperation(value = "删除视频")
    @PostMapping("/deleteVideo")
    @RequireSign
    public CommonResponse<Void> deleteVideo(@RequestBody DeleteVideoParam param) {
        service.deleteVideo(param);
        return CommonResponse.success();
    }

    @ApiOperation(value = "视频审核回调")
    @PostMapping("/callback/videoAudit")
    @JwtIgnore
    public CommonResponse<Void> videoAuditCallBack(@RequestBody VideoAuditCallBackParam param) {
//        service.videoAuditCallBack(param);
        return CommonResponse.success();
    }

    @ApiOperation(value = "上传视频列表")
    @PostMapping("/list")
    @RequireSign
    public CommonResponse<Page<UploadVideoItemVO>> uploadVideoList(@RequestBody UploadVideoListParam param) {
        return CommonResponse.success(service.uploadVideoList(param));
    }

}
