import re

from typing import Pattern

from faker.providers.passport.it_IT import Provider as ItPassportProvider


class TestDeAt:
    """Test de_AT passport provider methods"""

    def test_passport_number(self, faker, num_samples):
        for _ in range(num_samples):

            pattern: Pattern = re.compile(r"[A-Z]{1,2}\d{7}")
            passport_number = faker.passport_number()
            assert pattern.fullmatch(passport_number)


class TestItIT:
    """Test it_IT passport provider methods"""

    def test_passport_number(self, faker, num_samples):
        faker.add_provider(ItPassportProvider)

        pattern = re.compile(r"^[A-Z]{2}\d{7}$")

        for _ in range(num_samples):
            passport_number = faker.passport_number()
            assert pattern.fullmatch(passport_number)


class TestMkMk:
    """Test mk_MK passport provider methods"""

    def test_passport_number(self, faker, num_samples):
        # Format: 1 uppercase letter + 7 digits
        pattern = re.compile(r"^[A-Z]\d{7}$")
        for _ in range(num_samples):
            passport_number = faker.passport_number()
            assert pattern.fullmatch(passport_number), f"Unexpected format: {passport_number!r}"


class TestPassport:
    """Test passport provider methods"""

    def test_passport_number(self, faker, num_samples):
        for _ in range(num_samples):
            passport_number = faker.passport_number()
            assert isinstance(passport_number, str)
