package com.seer.teach.teacher.controller.app;

import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.DecryptionAnnotation;
import com.seer.teach.common.annotation.EncryptionAnnotation;
import com.seer.teach.common.annotation.LogOperation;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.common.enums.ModuleEnum;
import com.seer.teach.teacher.common.req.DoExerciseReq;
import com.seer.teach.teacher.common.req.StudyReq;
import com.seer.teach.teacher.common.resp.DoExerciseResp;
import com.seer.teach.teacher.service.StudyService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * @Author: Captain
 * @Description: 预习Controller
 * @Date: 2025-06-12 13:57
 */
@RequestMapping("/app/study")
@RestController
@Tag(name = "APP - 学习")
@Validated
/*@EncryptionAnnotation
@DecryptionAnnotation*/
@RequiredArgsConstructor
public class StudyController {

    private final StudyService studyService;

    @LogPrint
    @Operation(summary = "学习")
    @PostMapping("/learn")
    @LogOperation(module = ModuleEnum.SEER_TEACHER, subModule = "预习")
    public ResultBean preview(@RequestBody @Validated StudyReq params) {
        studyService.study(params);
        return ResultBean.success("success");
    }

    @LogPrint
    @Operation(summary = "做题")
    @PostMapping("/doExercise")
    public ResultBean<DoExerciseResp> doExercise(@RequestBody @Validated DoExerciseReq params) {
        DoExerciseResp results = studyService.doExercise( params);
        return ResultBean.success(results);
    }

}
