package dev.inmo.postssystem.features.auth.common

import com.benasher44.uuid.uuid4
import dev.inmo.postssystem.features.users.common.Username
import kotlinx.serialization.*
import kotlin.jvm.JvmInline

sealed interface AuthKey

@Serializable
@SerialName("authcreds")
data class AuthCreds(
    val username: Username,
    val password: String
): AuthKey


@Serializable
@SerialName("token")
@JvmInline
value class AuthToken(val string: String = uuid4().toString()): AuthKey {
    override fun toString(): String = string
}

@Serializable
@SerialName("refresh")
@JvmInline
value class RefreshToken(val string: String = uuid4().toString()): AuthKey {
    override fun toString(): String = string
}

@Serializable
data class AuthTokenInfo(
    val token: AuthToken,
    val refresh: RefreshToken
)
