package com.fs.app.controller;

import com.fs.common.core.domain.R;
import com.fs.course.param.FsUserCourseParam;
import com.fs.course.param.FsUserCourseVideoParam;
import com.fs.course.param.SopRoomCourseParam;
import com.fs.course.service.IFsUserCourseService;
import com.fs.course.service.IFsUserCourseVideoService;
import com.fs.course.vo.FsUserCourseListPVO;
import com.fs.course.vo.FsUserCourseVideoVO;
import com.fs.qw.service.IQwUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/app/room")
public class RoomSopController {
    @Autowired
    IQwUserService qwUserService;

    @Autowired
    IFsUserCourseService courseService;

    @Autowired
    IFsUserCourseVideoService courseVideoService;

    @GetMapping("/getCourseList")
    public R getCourseList(SopRoomCourseParam param) {
        Long companyId = qwUserService.getQwUserCompanyId(param.getCorpId(),param.getQwUserid());
        FsUserCourseParam fsUserCourse = new FsUserCourseParam();
        fsUserCourse.setCompanyId(companyId);
        fsUserCourse.setIsPrivate(1);
        PageHelper.startPage(param.getPageNum(), param.getPageSize());
        List<FsUserCourseListPVO> list = courseService.selectFsUserCourseListCompanyPVO(fsUserCourse);
        PageInfo<FsUserCourseListPVO> listPageInfo=new PageInfo<>(list);
        return R.ok().put("data",listPageInfo);
    }

    @GetMapping("/getVideoList")
    public R getVideoList(FsUserCourseVideoParam param) {
        PageHelper.startPage(param.getPageNum(), param.getPageSize());
        param.setCourseId(param.getCourseId());
        List<FsUserCourseVideoVO> list = courseVideoService.selectFsUserCourseVideoListByCourseIdAndCompany(param);
        PageInfo<FsUserCourseVideoVO> listPageInfo=new PageInfo<>(list);
        return R.ok().put("data",listPageInfo);
    }


    @GetMapping("/createLink")
    public R createLink(SopRoomCourseParam param) {
//        PageHelper.startPage(param.getPageNum(), param.getPageSize());
//        param.setCourseId(param.getCourseId());
//        List<FsUserCourseVideoVO> list = courseVideoService.selectFsUserCourseVideoListByCourseIdAndCompany(param);
//        PageInfo<FsUserCourseVideoVO> listPageInfo=new PageInfo<>(list);
//        return R.ok().put("data",listPageInfo);
        return R.ok();
    }





}
