package com.ym.mec.student.controller;

import com.ym.mec.auth.api.client.SysUserFeignService;
import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.dal.dao.EmployeeDao;
import com.ym.mec.biz.dal.entity.Employee;
import com.ym.mec.biz.dal.page.CourseReviewQueryInfo;
import com.ym.mec.biz.service.CourseReviewService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RequestMapping("courseReview")
@Api(tags = "课程评价")
@RestController
public class CourseReviewController extends BaseController {

    @Autowired
    private SysUserFeignService sysUserFeignService;

    @Autowired
    private CourseReviewService courseReviewService;


    @ApiOperation(value = "评论详情")
    @GetMapping("getReviewInfo")
    public HttpResponseResult getReviewInfo(int id) {
        return succeed(courseReviewService.getReviewInfo(id));
    }

    @ApiOperation(value = "获取老师评价和学生评价")
    @GetMapping("getStuAndTeaReviewInfo")
    public HttpResponseResult getStuAndTeaReviewInfo(Long courseScheduleId) {
        SysUser sysUser = sysUserFeignService.queryUserInfo();
        if (sysUser == null) {
            return failed(HttpStatus.FORBIDDEN, "请登录");
        }
        return succeed(courseReviewService.getStuAndTeaReviewInfo(courseScheduleId,sysUser.getId()));
    }

}
