package com.izouma.nineth.service;

import com.izouma.nineth.domain.PurchaseLevel;
import com.izouma.nineth.dto.PageQuery;
import com.izouma.nineth.repo.PurchaseLevelRepo;
import com.izouma.nineth.utils.JpaUtils;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class PurchaseLevelService {

    private PurchaseLevelRepo purchaseLevelRepo;

    public Page<PurchaseLevel> all(PageQuery pageQuery) {
        return purchaseLevelRepo.findAll(JpaUtils.toSpecification(pageQuery, PurchaseLevel.class), JpaUtils.toPageRequest(pageQuery));
    }
}
