package dev.dinauer.maven.jpa.maven.repo;

import dev.dinauer.maven.jpa.maven.ArtifactId;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import io.quarkus.panache.common.Parameters;
import jakarta.enterprise.context.ApplicationScoped;

import java.util.Optional;

@ApplicationScoped
public class ArtifactRepo implements PanacheRepositoryBase<ArtifactId, String>
{
    public Optional<ArtifactId> findOptionalByArtifactId(String groupId, String artifactId)
    {
        return find("artifactId = :artifactId AND group.groupId = :groupId", Parameters.with("groupId", groupId).and("artifactId", artifactId)).firstResultOptional();
    }
}