package ru.soune.nocopy.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import ru.soune.nocopy.entity.company.Company;

import java.util.List;
import java.util.Optional;

@Repository
public interface CompanyRepository extends JpaRepository<Company, String> {
    Optional<Company> findByCompanyName(String companyName);

    Optional<Company> findByInn(String companyName);

    boolean existsByCompanyName(String companyName);

    List<Company> findByCompanyNameContainingIgnoreCase(String name);

    Page<Company> findAll(Pageable pageable);

    Page<Company> findByCompanyNameContainingIgnoreCase(String name, Pageable pageable);
}
