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

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
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.LogPrint;
import com.seer.teach.user.response.GradeResp;
import com.seer.teach.user.service.IGradeService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@EncryptionAnnotation
@DecryptionAnnotation
@RestController
@Tag(name = "App 年级信息接口")
@Validated
@LogPrint
@SaCheckLogin(type = StpUtil.TYPE)
@RequiredArgsConstructor
@RequestMapping("/app/grade")
public class AppGradeController {

    private final IGradeService gradeService;

    @PostMapping("/list")
    @Operation(summary = "获取年级选项")
    @SaCheckPermission("app:user:update:pad")
    public ResultBean<List<GradeResp>> list(){
        List<GradeResp> result = gradeService.padList();
        return ResultBean.success(result);
    }

}