package com.yida.data.school.secondClass.controller.out;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.school.secondClass.service.EduSecondClassCourseService;
import com.yida.data.school.vo.secondClass.CourseH5ContentVO;
import com.yida.data.school.vo.secondClass.CourseH5DetailVO;
import com.yida.data.school.vo.secondClass.CourseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "第二课堂-课程(不鉴权-外部使用)")
@Slf4j
@Validated
@RestController
@RequestMapping("/out/secondClass/course")
@RequiredArgsConstructor
public class OutEduSecondClassCourseController {

    private final EduSecondClassCourseService eduSecondClassCourseService;

    @ApiOperation("查询课程首页数据")
    @GetMapping("/getHomeInfo")
    public ResultBean<CourseH5ContentVO> getHomeInfo(Long deptId) {
        return ResultBean.buildSuccess(eduSecondClassCourseService.getHomeInfo(deptId));
    }

    @ApiOperation("查询课程详情数据")
    @GetMapping("/getCourseDetail")
    public ResultBean<CourseH5DetailVO> getCourseDetail(Long id) {
        return ResultBean.buildSuccess(eduSecondClassCourseService.getCourseDetail(id));
    }

    @ApiOperation("分页查询课程数据")
    @GetMapping("/listCoursePageBySubject")
    public ResultBean<IPage<CourseVO>> listCoursePageBySubject(Integer pageNum, Integer pageSize, Long subjectId,Long deptId) {
        return ResultBean.buildSuccess(eduSecondClassCourseService.listCoursePageBySubject(pageNum, pageSize, subjectId,deptId));
    }
}
