package org.javacodegeeks.hilla;

import com.vaadin.flow.server.auth.AnonymousAllowed;
import com.vaadin.hilla.BrowserCallable;
import com.vaadin.hilla.crud.CrudRepositoryService;
import com.vaadin.hilla.Nonnull;
//import jakarta.annotation.Nonnull;
//import lombok.NonNull;
import java.util.List;

@BrowserCallable
@AnonymousAllowed
public class CustomerService extends CrudRepositoryService<Customer, Long, CustomerRepository> {

    @Nonnull
    public List<@Nonnull Customer> findAll() {
        return getRepository().findAll();
    }

    public Customer findById(Long id) {
        return getRepository().findById(id)
            .orElseThrow();
    }
}
