"""Pytest fixtures for V2 extraction pipeline tests."""

import pytest
from pathlib import Path


@pytest.fixture(scope="session")
def customer_document_files():
    """Discover all Excel files in CustomerDocument/ folder.

    Returns:
        List[Path]: Sorted list of all Excel files (.xlsx, .xls, .xlsm)
    """
    folder = Path("CustomerDocument/")
    if not folder.exists():
        pytest.skip("CustomerDocument/ folder not found")

    patterns = ["**/*.xlsx", "**/*.xls", "**/*.xlsm"]
    files = []
    for pattern in patterns:
        files.extend(folder.glob(pattern))

    return sorted(files)


@pytest.fixture(scope="session")
def expected_file_counts():
    """Expected file counts by extension."""
    return {
        ".xlsx": 22,
        ".xls": 15,
        ".xlsm": 21,
        "total": 58
    }


def pytest_configure(config):
    """Configure pytest with custom markers."""
    config.addinivalue_line(
        "markers",
        "slow: marks tests as slow (deselect with '-m \"not slow\"')"
    )
    config.addinivalue_line(
        "markers",
        "integration: marks tests as integration tests"
    )
