package dev.fyloz.trial.colorrecipesexplorer.repository

import dev.fyloz.trial.colorrecipesexplorer.model.Employee
import dev.fyloz.trial.colorrecipesexplorer.model.EmployeeGroup
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository

@Repository
interface EmployeeRepository : JpaRepository<Employee, Long> {
    fun existsByFirstNameAndLastName(firstName: String, lastName: String): Boolean

    fun findByFirstNameAndLastName(firstName: String, lastName: String): Employee?

    fun findAllByGroup(group: EmployeeGroup): Collection<Employee>

    fun findByIsDefaultGroupUserIsTrueAndGroupIs(group: EmployeeGroup): Employee
}

@Repository
interface EmployeeGroupRepository : NamedJpaRepository<EmployeeGroup>
