package org.brapi.test.BrAPITestServer.repository.geno;

import java.util.Collection;
import java.util.List;

import org.brapi.test.BrAPITestServer.model.entity.geno.VariantEntity;
import org.brapi.test.BrAPITestServer.repository.BrAPIRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface VariantRepository extends BrAPIRepository<VariantEntity, String> {

	long countByVariantSet_Id(String variantSetId);

	@Query("SELECT v.variantSet.id, COUNT(v) FROM VariantEntity v WHERE v.variantSet.id IN :variantSetDbIds GROUP BY v.variantSet.id")
	List<Object[]> countVariantsGroupedByVariantSetId(@Param("variantSetDbIds") Collection<String> variantSetDbIds);

}
