package cy.hexor.furumi.data.repository

import android.os.Build
import javax.inject.Inject

class AuthDeviceInfo @Inject constructor() {
    val deviceName: String
        get() {
            val manufacturer = Build.MANUFACTURER.orEmpty().trim()
            val model = Build.MODEL.orEmpty().trim()

            return when {
                model.isBlank() -> DEFAULT_DEVICE_NAME
                manufacturer.isBlank() -> model
                model.startsWith(manufacturer, ignoreCase = true) -> model
                else -> "$manufacturer $model"
            }
        }

    companion object {
        private const val DEFAULT_DEVICE_NAME = "Android Device"
    }
}
