package com.cxy.classroll.teacher.controller;

import com.cxy.classroll.common.result.Result;
import com.cxy.classroll.model.entity.Lesson;
import com.cxy.classroll.model.vo.IdentifyAndID;
import com.cxy.classroll.teacher.service.TeacherLessonService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/teacher")
//教师数据接口
public class TeacherController {

    @Autowired
    TeacherLessonService teacherLessonService;

    @Operation(summary = "教师教授课程列表获取")
    @GetMapping("/getteacherlessonlist/{id}")
    public Result<List<Lesson>> getTeacherLessonList(@PathVariable Long id) {
        return Result.ok(teacherLessonService.getTeacherLessons(id));
    }

    @Operation(summary = "开始上课")
    @GetMapping("/classstart/{lessonid}")
    public Result<Boolean> classStart(@PathVariable Long lessonid){
        return Result.ok(teacherLessonService.lessonStart(lessonid));
    }

    @Operation(summary = "结束上课")
    @GetMapping("/classend/{lessonid}")
    public Result<Boolean> classEnd(@PathVariable Long lessonid){
        return Result.ok(teacherLessonService.lessonEnd(lessonid));
    }

}
