package com.ym.mec.education.controller;

import com.alibaba.fastjson.JSONObject;
import com.ym.mec.education.base.BaseResponse;
import com.ym.mec.education.base.PageResponse;
import com.ym.mec.education.req.HomeWorkReq;
import com.ym.mec.education.req.TeacherReq;
import com.ym.mec.education.service.ITeacherService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.asm.Advice;
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;

/**
 * @author : chengp
 * @version V1.0
 * @Description: TODO
 * @date Date : 2019年09月29日 9:54
 */

@RestController
@RequestMapping("api/teacher")
@Api(tags = "老师列表")
@Slf4j
public class TeacherController {

    @Autowired
    private ITeacherService teacherService;

    /**
     * 服务降级处理
     *
     * @return
     */
    private BaseResponse defaultFallback() {
        BaseResponse response = new BaseResponse();
        response.setReturnCode(500);
        response.setMessage("太拥挤了, 请稍后再试!");
        return response;
    }


    /**
     * @param req
     * @return
     */
    @PostMapping(value = "/teacherList")
    public PageResponse teacherList(@RequestBody TeacherReq req) {

        return teacherService.teacherList(req);
    }

    @PostMapping(value = "/teacherDetail")
    public BaseResponse teacherDetail(@RequestBody TeacherReq req) {
        return teacherService.teacherDetail(req);
    }

    /**
     * @return
     */
    @PostMapping(value = "/teacherVipClass")
    public PageResponse teacherVipClass(@RequestBody TeacherReq req) {

        return teacherService.teacherVipClass(req);
    }

    /**
     * 老师的日程安排
     * @param teacherReq
     * @return
     */
    @PostMapping("/dailySchedule")
    public PageResponse dailySchedule(@RequestBody TeacherReq teacherReq) {
        return teacherService.dailySchedule(teacherReq);
    }
}
