"""Tests for English regex patterns — data-driven from JSON fixtures."""

import pytest
from argus_redact.lang.en.patterns import PATTERNS as EN_PATTERNS
from argus_redact.lang.shared.patterns import PATTERNS as SHARED_PATTERNS
from argus_redact.pure.patterns import match_patterns

from tests.conftest import assert_pattern_match, parametrize_examples

ALL_EN_PATTERNS = EN_PATTERNS + SHARED_PATTERNS


@pytest.fixture
def en_patterns():
    return ALL_EN_PATTERNS


class TestEnglishPhone:
    @parametrize_examples("en_phone.json")
    def test_should_match_or_reject_when_phone_input(self, en_patterns, example):
        results = match_patterns(example["input"], en_patterns)
        assert_pattern_match(results, example, "phone")


class TestSSN:
    @parametrize_examples("en_ssn.json")
    def test_should_match_or_reject_when_ssn_input(self, en_patterns, example):
        results = match_patterns(example["input"], en_patterns)
        assert_pattern_match(results, example, "ssn")


class TestEnglishCreditCard:
    @parametrize_examples("en_credit_card.json")
    def test_should_match_or_reject_when_credit_card_input(self, en_patterns, example):
        results = match_patterns(example["input"], en_patterns)
        assert_pattern_match(results, example, "credit_card")


class TestEnglishDateOfBirth:
    @parametrize_examples("en_date_of_birth.json")
    def test_should_match_or_reject_when_dob_input(self, en_patterns, example):
        results = match_patterns(example["input"], en_patterns)
        assert_pattern_match(results, example, "date_of_birth")


class TestEnglishSensitive:
    @parametrize_examples("en_sensitive.json")
    def test_should_match_or_reject_when_sensitive_input(self, en_patterns, example):
        results = match_patterns(example["input"], en_patterns)
        assert_pattern_match(results, example)


class TestUSPassport:
    @parametrize_examples("en_passport.json")
    def test_should_match_or_reject_when_passport_input(self, en_patterns, example):
        results = match_patterns(example["input"], en_patterns)
        assert_pattern_match(results, example, "us_passport")
