package com.izouma.uwip.service;

import com.izouma.uwip.domain.Patent;
import com.izouma.uwip.dto.PageQuery;
import com.izouma.uwip.repo.PatentRepo;
import com.izouma.uwip.utils.JpaUtils;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class PatentService {

    private final PatentRepo patentRepo;

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