"""Password strength validation.

Follows the ``URLValidator`` pattern — a class with static methods so
callers can use ``PasswordValidator.validate_strength(pw)`` without
instantiation.
"""

import re


class PasswordValidator:
    """Validate password strength requirements."""

    @staticmethod
    def get_requirements() -> list[str]:
        """Return human-readable password requirement labels.

        Co-located with ``validate_strength`` so the two cannot drift apart.
        """
        return [
            "At least 8 characters long",
            "At least one lowercase letter",
            "At least one digit",
        ]

    @staticmethod
    def validate_strength(password: str) -> list[str]:
        """Return a list of error strings for *password*.

        An empty list means the password meets all requirements.

        Checks:
        - Minimum length of 8 characters
        - At least one lowercase letter
        - At least one digit
        """
        errors: list[str] = []

        if len(password) < 8:
            errors.append("Password must be at least 8 characters")
        if not re.search(r"[a-z]", password):
            errors.append("Password must contain at least one lowercase letter")
        if not re.search(r"\d", password):
            errors.append("Password must contain at least one digit")

        return errors
