package enea.lecservice.controllers;

import enea.lecservice.entities.Permission;
import enea.lecservice.models.dto.ServiceResponse;
import enea.lecservice.services.PermissionsService;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
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;

@RestController
@RequestMapping("/permissions")
@RequiredArgsConstructor
public class PermissionsController {

    @NonNull PermissionsService permissionsService;

    @GetMapping("/admin/list")
    public ServiceResponse<List<Permission>> getPermissions() {
        return permissionsService.findAll();
    }
}
