package ru.soune.nocopy.repository;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import ru.soune.nocopy.entity.file.FileType;
import ru.soune.nocopy.entity.user.UserContent;

import java.util.List;

public interface UserContentRepository extends JpaRepository<UserContent, Long> {
    List<UserContent> findByUserIdOrderByUploadDateDesc(Long userId);

    List<UserContent> findByUserId(Long userId);

    List<UserContent> findByUserIdAndFileTypeOrderByUploadDateDesc(Long userId, FileType type, Pageable pageable);

    long countByUserIdAndFileType(Long userId, FileType type);

    long countByUserId(Long userId);
}
