package ru.myitschool.work.domain.auth

import kotlin.text.all

class CheckPasswordFormatUseCase {
    operator fun invoke(
        password: String
    ): Boolean {
        return password.length >= 8 && password.all{char ->
            (char in 'A'..'Z' || char in 'a'..'z' || char.isDigit()) || (char == '!' || char == '@' ||
                    char == '#' || char == '$' || char == '&' || char == '*')}
    }
    fun validatePassword(password: String, login: String): Boolean {
        val loginChars = login.lowercase().toSet()
        return !password.lowercase().any{
            it in loginChars
        }
    }
}