package sklep.rest;

import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import sklep.model_jpa.Product;
import sklep.model_jpa.ProductList;
import sklep.repo.ProductRepository;

@Path("/e/products.pdf")
@Produces("application/pdf")
public class EProductsPDF {
    @Inject
    private ProductRepository productRepository;

    @GET
    public ProductList allProducts() {
        return new ProductList(productRepository.listAll());
    }

    @Path("/{id}")
    @GET
    public Product oneProduct(@PathParam("id") Long id) {
        return productRepository.findById(id);
    }

}
