package com.younike.member;

import com.younike.common.core.controller.BaseController;
import com.younike.common.core.domain.AjaxResult;
import com.younike.framework.config.AnonymousAccess;
import com.younike.system.domain.vo.VideoVo;
import com.younike.system.param.VideoParam;
import com.younike.system.service.IVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 【请填写功能名称】Controller
 *
 * @author elev
 * @date 2022-04-13
 */
@Api("【会员端:视频】接口")
@RestController
@RequestMapping("/member/video")
public class MemberVideoController extends BaseController {
    @Autowired
    private IVideoService videoService;


    @ApiOperation("查询【获取首页运营推荐的三条视频】列表")
    @AnonymousAccess
//        @MemberAccess
    @GetMapping("/recommendVideoList")
    public Object recommendVideoList(VideoParam video) {
        if(ObjectUtils.isEmpty(video) ||video.getBizType() == null){
            return AjaxResult.error("参数错误");
        }
        startPage();
        List<VideoVo> list = videoService.getRecommendVideoList(video);
        return getDataTable(list);
    }

    @ApiOperation("查询【服务人员视频列表】列表")
    @AnonymousAccess
//        @MemberAccess
    @GetMapping("/serverVideoList")
    public Object serverVideoList(VideoParam video) {
        if(ObjectUtils.isEmpty(video) || video.getServerId() == null ||video.getBizType() == null){
            return AjaxResult.error("参数错误");
        }
        startPage();
        List<VideoVo> list = videoService.serverVideoList(video);
        return getDataTable(list);
    }

    @ApiOperation("查询【店铺视频列表】列表")
    @AnonymousAccess
//        @MemberAccess
    @GetMapping("/merchantVideoList")
    public Object merchantVideoList(VideoParam video) {
        if(ObjectUtils.isEmpty(video) || video.getMerchantId() == null||video.getBizType() == null){
            return AjaxResult.error("参数错误");
        }
        startPage();
        List<VideoVo> list = videoService.merchantVideoList(video);
        return getDataTable(list);
    }

    @ApiOperation("查询【百科视频】列表")
    @AnonymousAccess
//        @MemberAccess
    @GetMapping("/videoList")
    public Object videoList(VideoParam video) {
        if(ObjectUtils.isEmpty(video) ||video.getBizType() == null){
            return AjaxResult.error("参数错误");
        }
        startPage();
        List<VideoVo> list = videoService.videoList(video);
        return getDataTable(list);
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @AnonymousAccess
    @ApiOperation("获取【请填写功能名称】详细信息")
    @GetMapping(value = "/{videoId}")
    public AjaxResult getInfo(@PathVariable("videoId") Long videoId) {
        return AjaxResult.success(videoService.getInfo(videoId));
    }

}
