package com.ruoyi.web.controller.basic;

import com.ruoyi.RestResponse;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.course.domain.req.ReqSearchClaTime;
import com.ruoyi.course.domain.time.RespBusinessClaTimeCalendar;
import com.ruoyi.course.service.ScClaTimeService;
import com.ruoyi.system.domain.SysTeacher;
import com.ruoyi.system.service.SysTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

import java.util.List;
import java.util.Map;

@Api(tags = "022-教练", description = "获取教练信息")
@RestController
@RequestMapping("/api/context")
public class ContextAppController extends BaseController {
    @Autowired
    private  SysTeacherService teacherService;
    @Autowired
    private  ScClaTimeService scClaTimeService;

    @Autowired
    private SysTeacherService staffService;

    /**
     * visitStore
     * @param params
     * @return
     */
    @ApiOperation("教练列表")
    @PostMapping(value = "/getList")
    public RestResponse findList1(@RequestBody Map<String, Object> params) {
        List<SysTeacher> list = teacherService.getList(Long.parseLong(params.get("visitStore").toString()));
        return new RestResponse().setSuccess(true).setMessage("成功").setData(list);
    }

    @ApiOperation("教练详细信息")
    @PostMapping("/getOne")
    public RestResponse update(@RequestBody Map<String, String> params) {
        SysTeacher c = teacherService.getByUserId(params.get("userId").toString());
        return RestResponse.success().setData(c);
    }
    @ApiOperation("教练课程表")
    @PostMapping("/searchListForCalendar")
    public RestResponse searchListForCalendar(@RequestBody ReqSearchClaTime reqSearchClaTime) {
        RespBusinessClaTimeCalendar c =scClaTimeService.searchListForCalendar(reqSearchClaTime);
        return RestResponse.success().setData(c);
    }

}
