package dp.kotul.jwtapi.service

import dp.kotul.jwt.model.User
import dp.kotul.jwtapi.model.InstanceSession
import dp.kotul.jwtapi.repository.InstancesRepository
import org.springframework.stereotype.Service

interface UserService {
    fun getUserBySession(instanceSession: InstanceSession): User?
}

@Service
class UserServiceImpl(
    val instancesRepository: InstancesRepository
) : UserService {

    override fun getUserBySession(instanceSession: InstanceSession): User? {
       return instancesRepository.getUserBySession(instanceSession.sessionId, instanceSession.instanceId)
    }
}
