package dev.lions.unionflow.server.repository;

import dev.lions.unionflow.server.entity.BaremeCotisationRole;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.List;
import java.util.Optional;
import java.util.UUID;

@ApplicationScoped
public class BaremeCotisationRoleRepository implements PanacheRepositoryBase<BaremeCotisationRole, UUID> {

    public Optional<BaremeCotisationRole> findByOrganisationIdAndRoleOrg(UUID organisationId, String roleOrg) {
        return find("organisation.id = ?1 AND roleOrg = ?2", organisationId, roleOrg).firstResultOptional();
    }

    public List<BaremeCotisationRole> findByOrganisationId(UUID organisationId) {
        return find("organisation.id = ?1", organisationId).list();
    }
}
