package com.magistr.app.repository;

import com.magistr.app.model.Role;
import com.magistr.app.model.User;
import org.springframework.data.jpa.repository.JpaRepository;

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

public interface UserRepository extends JpaRepository<User, Long> {

    Optional<User> findByUsername(String username);

    List<User> findByRole(Role role);

    List<User> findByRoleAndDepartmentId(Role role, Long departmentId);

    List<User> findByStatusNot(String status);

    List<User> findByRoleAndStatusNot(Role role, String status);

    List<User> findByRoleAndDepartmentIdAndStatusNot(Role role, Long departmentId, String status);
}
