package ink.wgink.module.file.media.controller.app.srs.rtmp;

import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.module.file.media.pojo.vos.rtmp.RtmpCallbackVO;
import ink.wgink.pojo.result.SuccessResultCode;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: RtmpController
 * @Description: rtmp 回调
 * @Author: wanggeng
 * @Date: 2022/4/22 10:39
 * @Version: 1.0
 */
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "rtmp回调接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/srs-rtmp-callback")
public class SrsRtmpCallbackAppController extends DefaultBaseController {

    @PostMapping("on-connect")
    public SuccessResultCode<Integer> onConnect(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
        System.out.println("onConnect");
        System.out.println(rtmpCallbackVO);
        return new SuccessResultCode<>(0);
    }

    @PostMapping("on-close")
    public SuccessResultCode<Integer> onClose(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
        System.out.println("onClose");
        System.out.println(rtmpCallbackVO);
        return new SuccessResultCode<>(0);
    }

    @PostMapping("on-publish")
    public SuccessResultCode<Integer> onPublish(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
        System.out.println("onPublish");
        System.out.println(rtmpCallbackVO);
        return new SuccessResultCode<>(0);
    }

    @PostMapping("on-unpublish")
    public SuccessResultCode<Integer> onUnPublish(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
        System.out.println("onUnPublish");
        System.out.println(rtmpCallbackVO);
        return new SuccessResultCode<>(0);
    }

    @PostMapping("on-play")
    public SuccessResultCode<Integer> onPlay(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
        System.out.println("onPlay");
        System.out.println(rtmpCallbackVO);
        return new SuccessResultCode<>(0);
    }

    @PostMapping("on-stop")
    public SuccessResultCode<Integer> onStop(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
        System.out.println("onStop");
        System.out.println(rtmpCallbackVO);
        return new SuccessResultCode<>(0);
    }

    @PostMapping("on-dvr")
    public SuccessResultCode<Integer> onDvr(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
        System.out.println("onDvr");
        System.out.println(rtmpCallbackVO);
        return new SuccessResultCode<>(0);
    }

}
