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

import org.brapi.test.BrAPITestServer.model.entity.core.ListEntity;
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 ListRepository extends BrAPIRepository<ListEntity, String>{
	@Query(value = "SELECT l FROM ListEntity l ORDER BY SIZE(l.data) DESC, l.id ASC",
			countQuery = "SELECT COUNT(l) FROM ListEntity l")
	Page<ListEntity> findAllPrioritizePopulated(Pageable pageReq);
}
