package com.agent.management.repository;

import com.agent.management.model.entity.KbDocument;
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 java.util.List;

@Repository
public interface KbDocumentRepository extends JpaRepository<KbDocument, Long> {

    Page<KbDocument> findByCategoryId(Long categoryId, Pageable pageable);

    Page<KbDocument> findByNameContainingIgnoreCase(String keyword, Pageable pageable);

    Page<KbDocument> findByCategoryIdAndNameContainingIgnoreCase(Long categoryId, String keyword, Pageable pageable);

    long countByCategoryId(Long categoryId);

    List<KbDocument> findByStatus(String status);
}
