package ru.myitschool.work.domain.auth

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import javax.inject.Inject

class CheckValidLoginUseCase @Inject constructor() {
    suspend operator fun invoke(login: String): Boolean {
        return withContext(Dispatchers.Default) {
            login.isNotBlank() &&
                    login.length >= 3 &&
                    !login[0].isDigit() &&
                    login.all { char -> char.isLetterOrDigit() }
        }
    }
}