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

import org.brapi.test.BrAPITestServer.model.entity.geno.VariantSetEntity;
import org.brapi.test.BrAPITestServer.repository.BrAPIRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

public interface VariantSetRepository extends BrAPIRepository<VariantSetEntity, String> {
	@Query(value = "SELECT vs FROM VariantSetEntity vs ORDER BY SIZE(vs.variants) DESC, SIZE(vs.callSets) DESC, vs.id ASC",
			countQuery = "SELECT COUNT(vs) FROM VariantSetEntity vs")
	Page<VariantSetEntity> findAllPrioritizePopulated(Pageable pageReq);

}
