package CHAPTER08;

public class LAB_08_01_Verification {
    public static void main(String[] args) {
        String userId = "User2025";
        String password = "S3cure!Pass";

        // ID 유효성 검사
        if (userId.length() >= 6 && userId.matches("[A-Za-z0-9]+")) {
            System.out.println("ID 형식이 유효합니다.");
        } else {
            System.out.println("ID 형식이 잘못되었습니다.");
        }

        // 비밀번호 복잡도 평가
        boolean hasUpper = password.matches(".*[A-Z].*");
        boolean hasDigit = password.matches(".*\\d.*");
        boolean hasSpecial = password.matches(".*[!@#$%^&*].*");

        int strength = (hasUpper ? 1 : 0) + (hasDigit ? 1 : 0) + (hasSpecial ? 1 : 0);
        String level;

        switch (strength) {
            case 3: level = "강함"; break;
            case 2: level = "보통"; break;
            default: level = "약함"; break;
        }

        System.out.println("비밀번호 보안 수준: " + level);

        // 랜덤 보안 토큰 생성 (Math 클래스 사용)
        int token = (int)(Math.random() * 1000000); // 6자리 토큰
        System.out.printf("임시 인증 토큰: %06d\n", token);
    }
}
