package ru.kayashov.bar.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ru.kayashov.bar.model.entity.Glass;

import javax.annotation.security.PermitAll;
import java.util.Arrays;
import java.util.List;

@Slf4j
@CrossOrigin(origins = {"*"})
@RestController
@RequestMapping("/api/glass")
@RequiredArgsConstructor
public class GlassController {

    @PermitAll
    @GetMapping
    public List<String> getGlass() {
        return Arrays.stream(Glass.values()).map(Glass::getName).toList();
    }
}
