package com.seer.teach.common.auth.controller;

import com.seer.teach.common.auth.dto.PermissionDTO;
import com.seer.teach.common.auth.service.PermissionScannerService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@RestController
@Tag(name = "权限扫描")
@RequestMapping("/internal")
public class PermissionScanController {

    private final PermissionScannerService permissionScannerService;

    @Operation(summary = "扫描权限注解")
    @GetMapping("/permissions")
    public List<PermissionDTO> scanPermissions() {
        return permissionScannerService.scanPermissionAnnotations();
    }
}