package dev.inmo.postssystem.features.auth.server.tokens

import dev.inmo.postssystem.features.auth.common.*
import dev.inmo.postssystem.features.users.common.User

sealed class AuthTokenException : Exception()

object AuthTokenExpiredException : AuthTokenException()
object AuthTokenNotFoundException : AuthTokenException()
object UserNotFoundException : AuthTokenException()


interface AuthTokensService {
    /**
     * @return [User] or one of failure exceptions: [AuthTokenException]
     */
    suspend fun getUserPrincipal(authToken: AuthToken): Result<User>
}
