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.TeacherWebService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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
@Tag(name = "教师接口管理")
@RestController
@RequestMapping("/teacher")
public class TeacherWebController {

    @Autowired
    TeacherWebService teacherWebService;

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

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

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