package com.mvrent.carrental.repository;

import com.mvrent.carrental.model.User;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface UserRepository extends JpaRepository<User, Long> {
    Optional<User> findByUsername(String username);
    Optional<User> findByEmail(String email);
    boolean existsByUsername(String username);
    boolean existsByEmail(String email);
    long countByRole(com.mvrent.carrental.model.Role role);
    java.util.List<User> findByRoleOrderByFullName(com.mvrent.carrental.model.Role role);
    java.util.List<User> findByRoleInOrderByFullName(java.util.Collection<com.mvrent.carrental.model.Role> roles);
    long countByRoleAndEnabledTrue(com.mvrent.carrental.model.Role role);
}
