# __Author__: Khoi Van 2021

from json import load
import os
import sys

sys.path.append(os.path.realpath('src'))

import csv
from operator import itemgetter
from pathlib import Path
from typing import Dict, List, Set, Tuple

import pytest
from src.find_manuals import find_match, load_directory_file


CURRENT_FILEPATH = Path(__file__).resolve().parent.parent
DATA_FOLDER = CURRENT_FILEPATH.parent / 'src' / 'data'
INPUT_FOLDER = DATA_FOLDER / 'manuals'


@pytest.fixture
def directory() -> List[Dict[str, str]]:
    return load_directory_file()


@pytest.mark.parametrize(
    "item, expect", [
        ({'manufacturerSKU': 'VF2927L', 'brand': 'Dimplex'},                                # Dimplex
         'Dimplex/7213460100R05_EN.pdf'),
        ({'manufacturerSKU': 'RBF30WC', 'brand': 'Dimplex'},
         'Dimplex/Revillusion_Dimplex.pdf'),
        ({'manufacturerSKU': 'PF3033HG', 'brand': 'Dimplex'},
         'Dimplex/PF3033_Dimplex.pdf'),
        ({'manufacturerSKU': 'XLF50', 'brand': 'Dimplex'},
         'Dimplex/XLF100_Dimplex.pdf'),
        ({'manufacturerSKU': 'XLF60', 'brand': 'Dimplex'},
         'Dimplex/7215520100R00.pdf'),
        ({'manufacturerSKU': 'CDFI1000-PRO', 'brand': 'Dimplex'},
         'Dimplex/CDFI_Owners_Manual_7214300200R03.pdf'),
        ({'manufacturerSKU': 'GBF1500-PRO', 'brand': 'Dimplex'},
         'Dimplex/CDFI_Owners_Manual_7214300200R03.pdf'),
        ({'manufacturerSKU': 'GBF1000-PRO', 'brand': 'Dimplex'},
         'Dimplex/CDFI_Owners_Manual_7214300200R03.pdf'),
        ({'manufacturerSKU': 'VF2927L', 'brand': 'Dimplex'},
         'Dimplex/7213460100R05_EN.pdf'),
        ({'manufacturerSKU': 'BLF3451', 'brand': 'Dimplex'},
         'Dimplex/7213990100R02_EN.pdf'),
        ({'manufacturerSKU': 'BLF5051', 'brand': 'Dimplex'},
         'Dimplex/BLF5051.pdf'),
        ({'manufacturerSKU': 'BLF7451', 'brand': 'Dimplex'},
         'Dimplex/7214000100R01_EN.pdf'),
        ({'manufacturerSKU': 'BLF50', 'brand': 'Dimplex'},
         'Dimplex/7210380100R05_EN.pdf'),
        ({'manufacturerSKU': '4PVP-24SS', 'brand': 'DuraVent',                              # DuraVent
          'c__series': 'PelletVent Pro'},
         'DuraVent/duraVentPelletVentPro.pdf'),
        ({'manufacturerSKU': '46DVA-17TA', 'brand': 'DuraVent',
          'c__series': 'DirectVent Pro'},
         'DuraVent/duraVentDirectPro.pdf'),
        ({'manufacturerSKU': '46DVA-H2-SNK36', 'brand': 'DuraVent',
          'c__series': 'DirectVent Pro'},
         'DuraVent/duraVentDirectPro.pdf'),
        ({'manufacturerSKU': '46DVA-H2', 'brand': 'DuraVent',
          'c__series': 'DirectVent Pro'},
         'DuraVent/duraVentDirectPro.pdf'),
        ({'manufacturerSKU': '3DFA-25', 'brand': 'DuraVent',
          'c__series': 'DuraFlex Aluminum'},
         'DuraVent/duraVentDuraFlexAluminum.pdf'),

        ({'manufacturerSKU': 'VFSL30FP7010N', 'brand': 'Empire'},                             # Empire
         'Empire/VFSL30FP-Boulevard-SL-VF-Linear-Fireplace.pdf'),
        ({'manufacturerSKU': 'LS48THF', 'brand': 'Empire',
          'c__productCategory': 'Media Kits'},
         'ignore'),
        ({'manufacturerSKU': 'LS60THF', 'brand': 'Empire',
          'c__productCategory': 'Media Kits'},
         'ignore'),
        ({'manufacturerSKU': 'BVD36FP30FN', 'brand': 'Empire'},
         'Empire/BVD343642FP35.pdf'),
        ({'manufacturerSKU': 'DVC26IN31N', 'brand': 'Empire'},
         'Empire/DVC202628IN37-1.pdf'),
        ({'manufacturerSKU': 'DVCC32BP32N', 'brand': 'Empire'},
         'Empire/DVCC323642BP-4-Installer.pdf'),
        ({'manufacturerSKU': 'DVCD42FP30N', 'brand': 'Empire'},
         'Empire/DVCD323642FP3701NP-4-Homeowners.pdf'),
        ({'manufacturerSKU': 'DVCP42BP30N', 'brand': 'Empire'},
         'Empire/DVCP323642BP-4-Installer.pdf'),
        ({'manufacturerSKU': 'DVCT35CBN95N', 'brand': 'Empire'},
         'Empire/DVCT3035CBN-1.pdf'),
        ({'manufacturerSKU': 'DVCT36CBP95N', 'brand': 'Empire'},
         'Empire/DVCT3640CBP95-Homeowner.pdf'),
        ({'manufacturerSKU': 'DVCT40CSP95N', 'brand': 'Empire'},
         'Empire/DVCT40CSP95NP-1-Installer 40651-3-0520.pdf'),
        ({'manufacturerSKU': 'DVCX42FP30N', 'brand': 'Empire'},
         'Empire/DVCX36-42FP30.pdf'),
        ({'manufacturerSKU': 'DVL33IN33N', 'brand': 'Empire'},
         'Empire/DVL2533IN.pdf'),
        ({'manufacturerSKU': 'DVLL41FP92N', 'brand': 'Empire'},
         {'Empire/DVLL41FP-Boulevard-Direct-Vent-Linear-Contemporary-Fireplace.pdf',
          'Empire/DVTLL41FP9-3_DV_installation_manual.pdf'}
         ),
        ({'manufacturerSKU': 'DVP36PP32EN', 'brand': 'Empire'},
         'Empire/DVP36PPSPENP-3.pdf'),
        ({'manufacturerSKU': 'DVX42FP31LN', 'brand': 'Empire'},
         'Empire/DVX3642FP3579 (2).pdf'),
        ({'manufacturerSKU': 'DVL25FP32N', 'brand': 'Empire'},
         'Empire/DVL25FP-Loft-DV-Fireplace.pdf'),
        ({'manufacturerSKU': 'DVL25IN33N', 'brand': 'Empire'},
         'Empire/DVL2533IN.pdf'),
        ({'manufacturerSKU': 'DVL33FP32N', 'brand': 'Empire'},
         'Empire/DVL25FP-Loft-DV-Fireplace.pdf'),
        ({'manufacturerSKU': 'DVL33IN33N', 'brand': 'Empire'},
         'Empire/DVL2533IN.pdf'),
        ({'manufacturerSKU': 'DVLL27FP92N', 'brand': 'Empire'},
         'Empire/DVLL27FP-Forest-Hills-Portrait-Contemporary-Fireplace.pdf'),
        ({'manufacturerSKU': 'DVLL48BP92N', 'brand': 'Empire'},
         {'Empire/DVLL36BP92NP-1 DVLL48BP92NP-2 40375-0-0519-Installer.pdf',
          'Empire/DVLL4860BP90NP-1.pdf'}
         ),
        ({'manufacturerSKU': 'DVP20CC30FN', 'brand': 'Empire'},
         'Empire/DVP2030CC-2.pdf'),
        ({'manufacturerSKU': 'DVTL27FP90N', 'brand': 'Empire'},
         'Empire/DVTL27FP-Forest-Hills-Portrait-Traditional-Fireplace.pdf'),
        ({'manufacturerSKU': 'DVTL41BP90N', 'brand': 'Empire'},
         {'Empire/DVTLL41FP9-3_DV_installation_manual.pdf',
          'Empire/DVLL41FP-Boulevard-Direct-Vent-Linear-Contemporary-Fireplace.pdf'
          }
         ),
        ({'manufacturerSKU': 'DVX36FP31LN', 'brand': 'Empire'},
         'Empire/DVX3642FP3579 (2).pdf'),
        ({'manufacturerSKU': 'OLL48SP12SN', 'brand': 'Empire'},
         'Empire/OLL48FPSP12SNP-2.pdf'),
        ({'manufacturerSKU': 'OL48TP10N', 'brand': 'Empire'},
         'Empire/OL4860TP1018NP-1-Outdoor-Firepit.pdf'),
        ({'manufacturerSKU': 'OLL60SP12SN', 'brand': 'Empire'},
         'Empire/OLL60FPSP12SNP-1.pdf'),
        ({'manufacturerSKU': 'OL60TP10N', 'brand': 'Empire'},
         'Empire/OL4860TP1018NP-1-Outdoor-Firepit.pdf'),
        ({'manufacturerSKU': 'ONR24N', 'brand': 'Empire'},
         'Empire/ONRI-2430-2.pdf'),
        ({'manufacturerSKU': 'OLI24N', 'brand': 'Empire'},
         'Empire/OLI-2430-2R.pdf'),
        ({'manufacturerSKU': 'OP36FP32MN', 'brand': 'Empire'},
         'Empire/OP3642FP372MNP-3.pdf'),
        ({'manufacturerSKU': 'OP42FP32MN', 'brand': 'Empire'},
         'Empire/OP3642FP372MNP-3.pdf'),
        ({'manufacturerSKU': 'VFD10CC30FN', 'brand': 'Empire'},
         'Empire/VFD1020CC3070BFMNP-1-VFD30CC3070FWBMSNP-1.pdf'),
        ({'manufacturerSKU': 'VFD26FP20LN', 'brand': 'Empire'},
         'Empire/VFD26FP237.pdf'),
        ({'manufacturerSKU': 'VFLB48FP30N', 'brand': 'Empire'},
         'Empire/VFLB3648FP390NP-1-Installer-Copy-1.pdf'),
        ({'manufacturerSKU': 'VFLB60SP90N', 'brand': 'Empire'},
         'Empire/VFLB60SP90NP-1-Installer-Copy-1.pdf'),
        ({'manufacturerSKU': 'VFLC28IN32N', 'brand': 'Empire'},
         'Empire/VFLC102028IN3272NP-1.pdf'),
        ({'manufacturerSKU': 'VFP36BP20LN', 'brand': 'Empire'},
         'Empire/VFP32BP-Vail-Premium-1.pdf'),
        ({'manufacturerSKU': 'VFPA32BP30LN', 'brand': 'Empire'},
         'Empire/VFPA32  VFPA36 39025-2-0620-VFPA3236BP3701LNP-2-Installer.pdf'),
        ({'manufacturerSKU': 'VFPC28IN33N', 'brand': 'Empire'},
         'Empire/VFPC2028IN3373NP-1.pdf'),
        ({'manufacturerSKU': 'VFSL30FP7010N', 'brand': 'Empire'},
         'Empire/VFSL30FP-Boulevard-SL-VF-Linear-Fireplace.pdf'),

        ({'manufacturerSKU': 'CFL-24NG-C', 'brand': 'Majestic'},                             # Majestic
         'Majestic/CFL-18-C,24-C, 30-C_owners-manual.pdf'),
        ({'manufacturerSKU': 'BE36', 'brand': 'Majestic'},
         'Majestic/BE36,42 - ROYALTON - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'LOGS-DRTWOOD-60', 'brand': 'Majestic',                         # item to ignore
          'c__productCategory': 'Media Kits'},
         'ignore'),
        ({'manufacturerSKU': 'SDLOGS-ODCOUG', 'brand': 'Majestic',
          'c__productCategory': 'Media Kits'},
         'ignore'),
        ({'manufacturerSKU': 'HDLOGS-ODCOUG', 'brand': 'Majestic',
          'c__productCategory': 'Media Kits'},
         'ignore'),
        ({'manufacturerSKU': 'DRTWOOD-JADE', 'brand': 'Majestic',
          'c__productCategory': 'Media Kits'},
         'ignore'),
        ({'manufacturerSKU': 'STFSO18', 'brand': 'Majestic'},
         'ignore'),
        ({'manufacturerSKU': 'ODGSR42ARN', 'brand': 'Majestic'},
         'Majestic/MAJESTIC_AL_FRESCO_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'ASH50', 'brand': 'Majestic'},
         'Majestic/ASH50 - ASHLAND - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'SB80', 'brand': 'Majestic'},
         'Majestic/SB60,80 HB - BILTMORE - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'SB100', 'brand': 'Majestic'},
         'Majestic/SB100 - BILTMORE - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'RCOR-DV36IN', 'brand': 'Majestic'},
         'Majestic/LCOR,RCOR-DV36IN - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'ODCOUG-36', 'brand': 'Majestic'},
         'Majestic/COURTYARD_OD_36-42_INSTALL_4608-901.pdf'),
        ({'manufacturerSKU': 'ODCOUG-42', 'brand': 'Majestic'},
         'Majestic/COURTYARD_OD_36-42_INSTALL_4608-901.pdf'),
        ({'manufacturerSKU': 'VDY24/18D3R', 'brand': 'Majestic'},
         'Majestic/VDY18,24,30 - DUZY.pdf'),
        ({'manufacturerSKU': 'ECHEL48STIN-C', 'brand': 'Majestic'},
         'Majestic/ECHEL36,48,60,72 - IN,STIN - ECHELON II - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'ODFORTG-36', 'brand': 'Majestic'},
         'Majestic/FORTRESS_ODFORTG-36_Install_4602-901.pdf'),
        ({'manufacturerSKU': 'JADE42IN-B', 'brand': 'Majestic'},
         'Majestic/JADE32IN-B, JADE42IN-B INSTALLATION.pdf'),
        ({'manufacturerSKU': 'ODLANAIG-51', 'brand': 'Majestic'},
         'Majestic/Lanai_ODLANAIG-51-Install_20308571.pdf'),
        ({'manufacturerSKU': 'MONTANA-36', 'brand': 'Majestic'},
         'Majestic/montana36-42.pdf'),
        ({'manufacturerSKU': 'MONTANA-42', 'brand': 'Majestic'},
         'Majestic/montana36-42.pdf'),
        ({'manufacturerSKU': 'OXDV30SP', 'brand': 'Majestic'},
         'Majestic/Oxford OXDV-IPI.pdf'),
        ({'manufacturerSKU': 'OXDV30_IPI', 'brand': 'Majestic'},
         'Majestic/Oxford OXDV-IPI.pdf'),
        ({'manufacturerSKU': 'ODPALGST-48', 'brand': 'Majestic'},
         'Majestic/Palazzo_single_and_see_thru_installation_manual.pdf'),
        ({'manufacturerSKU': 'ODPLAZA-L24S', 'brand': 'Majestic'},
         'Majestic/ODPLAZA-L24S Linear Installation Manual 4079-311.pdf'),
        ({'manufacturerSKU': 'RBV4842IT', 'brand': 'Majestic'},
         'Majestic/RBV4236, RBV4842 - REVEAL B-VENT - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'SA42C', 'brand': 'Majestic'},
         'Majestic/SA36C, SA42C - SOVERIGN - INSTALLATION.pdf'),
        ({'manufacturerSKU': 'TWILIGHT-II-C', 'brand': 'Majestic'},
         'Majestic/Twilight_II_installation_manual.pdf'),
        ({'manufacturerSKU': 'ODVILLAG-42T', 'brand': 'Majestic'},
         'Majestic/ODVILLAG-Villa-series.pdf'),
        ({'manufacturerSKU': 'ODVILLA-36T', 'brand': 'Majestic'},
         'Majestic/ODVILLA-Villawood-series.pdf'),

        ({'manufacturerSKU': 'AL144CLX2-G', 'brand': 'Modern Flames'},                      # Modern Flames
         'Modern Flames/Manual-AL-CLX-2.pdf'),
        ({'manufacturerSKU': 'FF43/BILV', 'brand': 'Modern Flames'},
         'Modern Flames/MODERN_FLAMES_BUILDER_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'SF40/BILV', 'brand': 'Modern Flames'},
         'Modern Flames/MODERN_FLAMES_BUILDER_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'HF42CBI', 'brand': 'Modern Flames'},
         'Modern Flames/Manual-Homefire_REV3.1_single.pdf'),
        ({'manufacturerSKU': 'LFV2-120/15-SH', 'brand': 'Modern Flames'},
         'Modern Flames/Manual-Landscape-GEN2-Rev2_singles.pdf'),
        ({'manufacturerSKU': 'LPM-4216', 'brand': 'Modern Flames'},
         'Modern Flames/MODERN_FLAMES_LANDSCAPE_PRO_2_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'LPM-6616', 'brand': 'Modern Flames'},
         'Modern Flames/MODERN_FLAMES_LANDSCAPE_PRO_2_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'LPM-7816', 'brand': 'Modern Flames'},
         'Modern Flames/MODERN_FLAMES_LANDSCAPE_PRO_2_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'SC36-B', 'brand': 'Modern Flames'},
         'Modern Flames/Manual-Spectrum-REV2-single.pdf'),
        ({'manufacturerSKU': 'SCO-26EL', 'brand': 'Modern Flames'},
         'Modern Flames/Manual-Sunset-Charred-Oak-singles-rev-3.pdf'),
        ({'manufacturerSKU': 'ZCR2-29C', 'brand': 'Modern Flames'},
         'Modern Flames/Manual-ZCR-2_singles.pdf'),

        ({'manufacturerSKU': 'NBST27-F', 'brand': 'Monessen'},                             # Monessen
         'Monessen/NBST27 - NATURAL BLAZE SEE THRU.pdf'),
        ({'manufacturerSKU': 'VFF36LNI', 'brand': 'Monessen'},
         'Monessen/VFF Fireplace System - ARIA.pdf'),
        ({'manufacturerSKU': 'AVFL42NIP', 'brand': 'Monessen'},
         'Monessen/AVFL42NIP-PIP - 05.20.pdf'),
        ({'manufacturerSKU': 'AVFLST42NTSC', 'brand': 'Monessen'},
         'Monessen/AVFLST42NTSC.pdf'),
        ({'manufacturerSKU': 'AVFLST42NIP', 'brand': 'Monessen'},
         'Monessen/AVFL42STNIP-PIP - Install-Owner Manual_4118-900.pdf'),
        ({'manufacturerSKU': 'VFI33LNI', 'brand': 'Monessen'},
         'Monessen/VFI33 - SOLSTICE.pdf'),
        ({'manufacturerSKU': 'SD30NV', 'brand': 'Monessen'},
         'Monessen/SD30PV - SD30NV - SUNDANCE.pdf'),
        ({'manufacturerSKU': 'VFC24LNI', 'brand': 'Monessen'},
         'Monessen/VFC - SYMPHONY.pdf'),

        ({'manufacturerSKU': 'SF-BI30-EB', 'brand': 'SimpliFire'},                      # SimpliFire
         'SimpliFire/2040_980-SF-BI30-EB-SFBI36-EB-INSTALL.pdf'),
        ({'manufacturerSKU': 'SF-WMS38-BK', 'brand': 'SimpliFire'},
         'SimpliFire/2040_911.pdf'),
        ({'manufacturerSKU': 'SF-WM94-BK', 'brand': 'SimpliFire'},
         'SimpliFire/2040_903.pdf'),
        ({'manufacturerSKU': 'SF-ALL84-BK', 'brand': 'SimpliFire'},
         'SimpliFire/2040_981_ALLUSION_OWNER_INSTALL MANUAL.pdf'),
        ({'manufacturerSKU': 'SF-ALLP50-BK', 'brand': 'SimpliFire'},
         'SimpliFire/2044_980_ALLUSION_PLATINUM_OWNER_INTALL.pdf'),
        ({'manufacturerSKU': 'SF-INS30-BK', 'brand': 'SimpliFire'},
         'SimpliFire/2042-922_SF-SI4027_SF-SI4432_Installation.pdf'),
        ({'manufacturerSKU': 'SF-SC43-BK', 'brand': 'SimpliFire'},
         'SimpliFire/2041_980_ SCION_OWNER_INSTALL_MANUAL.pdf'),
        ({'manufacturerSKU': 'SF-SCT55-BK', 'brand': 'SimpliFire'},
         'SimpliFire/2043_980_SF-SCT43-55-BK_OWNER-INSTALL.pdf'),

        ({'manufacturerSKU': 'GX70NTE-1', 'brand': 'Napoleon'},                             # Napoleon
         'Napoleon/Ascent-X-70-Series-Manual.pdf'),
        ({'manufacturerSKU': 'B30NTRE-1', 'brand': 'Napoleon'},
         'Napoleon/Ascent--30-Manual.pdf'),
        ({'manufacturerSKU': '1100CP-1', 'brand': 'Napoleon'},
         'Napoleon/1100P-C_1400P-C.pdf'),
        ({'manufacturerSKU': '1400CP', 'brand': 'Napoleon'},
         'Napoleon/1100P-C_1400P-C.pdf'),
        ({'manufacturerSKU': '1400M', 'brand': 'Napoleon'},
         'Napoleon/1100-1400-1900-deluxe-epa-pedestal-wood-burining-stoves-manual.pdf'),
        ({'manufacturerSKU': '1450M', 'brand': 'Napoleon'},
         'Napoleon/1100-1400-1900-deluxe-epa-pedestal-wood-burining-stoves-manual.pdf'),
        ({'manufacturerSKU': 'NEFL32FH', 'brand': 'Napoleon'},
         'Napoleon/Allure_Series_Installation_Manual_NEFL.pdf'),
        ({'manufacturerSKU': 'NEFL100FH', 'brand': 'Napoleon'},
         'Napoleon/Allure_Series_Installation_Manual_NEFL.pdf'),
        ({'manufacturerSKU': 'L38N2', 'brand': 'Napoleon'},
         'Napoleon/Acies-Series-Installation-Manual.pdf'),
        ({'manufacturerSKU': 'NEFL100CHD', 'brand': 'Napoleon'},
         'Napoleon/Alluravision--Installation---Operation-Manual---1-.pdf'),
        ({'manufacturerSKU': 'NEFL42CHS', 'brand': 'Napoleon'},
         'Napoleon/Alluravision--Installation---Operation-Manual---1-.pdf'),
        ({'manufacturerSKU': 'NEFL50FH-MT', 'brand': 'Napoleon'},
         'Napoleon/NEFL_Allure_Phantom_Series_Installation_Manual.pdf'),
        ({'manufacturerSKU': 'AX36NTE', 'brand': 'Napoleon'},
         'Napoleon/Altitude-X-Series-Installation--AX36---42-.pdf'),
        ({'manufacturerSKU': 'GDS20NSB', 'brand': 'Napoleon'},
         'Napoleon/GDS20-E--Manual--CSA-.pdf'),
        ({'manufacturerSKU': 'B36NTRE-1', 'brand': 'Napoleon'},
         'Napoleon/B36-1-Installation-Operation-Manual.pdf'),
        ({'manufacturerSKU': 'BHD4STGN', 'brand': 'Napoleon'},
         'Napoleon/Ascent-Multi-View-Manual.pdf'),
        ({'manufacturerSKU': 'BL36NTE-1', 'brand': 'Napoleon'},
         'Napoleon/Ascent-Linear-Series-Installation-Manual.pdf'),
        ({'manufacturerSKU': 'NEFB33H', 'brand': 'Napoleon'},
         'Napoleon/Ascent-Electric-Series-Manual.pdf'),
        ({'manufacturerSKU': 'GX36NTRE-1', 'brand': 'Napoleon'},
         'Napoleon/Ascent--X-36-Installation-Manual.pdf'),
        ({'manufacturerSKU': 'EFL42', 'brand': 'Napoleon'},
         'Napoleon/EFL42.pdf'),
        ({'manufacturerSKU': 'EFL42S', 'brand': 'Napoleon'},
         'Napoleon/EFL42S.pdf'),
        ({'manufacturerSKU': 'EFL50', 'brand': 'Napoleon'},
         'Napoleon/EFL50.pdf'),
        ({'manufacturerSKU': 'NEFV38', 'brand': 'Napoleon'},
         'Napoleon/NEFV38H.pdf'),
        ({'manufacturerSKU': 'NEFB27H', 'brand': 'Napoleon'},
         'Napoleon/NEFB24H-NEFB27H-NEFB29H-Cinema_Log_Series_NEFB27H-3A_Installation_Manual.pdf'),
        ({'manufacturerSKU': 'NEFB29HG', 'brand': 'Napoleon'},
         'Napoleon/NEFB242729HG-Cinema_Glass_Series_Installation_and_operation.pdf'),
        ({'manufacturerSKU': 'NEFBD50H', 'brand': 'Napoleon'},
         'Napoleon/NEFBD50H_NEFBD50H-SS_NEFBD50H-DT_NEFBDH-SS-DT_CLEARion_Series.pdf'),
        ({'manufacturerSKU': 'NEFBD50H-SS', 'brand': 'Napoleon'},
         'Napoleon/NEFBD50H_NEFBD50H-SS_NEFBD50H-DT_NEFBDH-SS-DT_CLEARion_Series.pdf'),
        ({'manufacturerSKU': 'NPI45', 'brand': 'Napoleon'},
         'Napoleon/NPS45_NPI45_ECO_PELLET_INSERT_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'NPS45', 'brand': 'Napoleon'},
         'Napoleon/NPS45_NPI45_ECO_PELLET_INSERT_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'GL30NE', 'brand': 'Napoleon'},
         'Napoleon/Fiberglow-Series-Manual.pdf'),
        ({'manufacturerSKU': 'GSS48', 'brand': 'Napoleon'},
         'Napoleon/Galaxy-series-manual.pdf'),
        ({'manufacturerSKU': 'GSS48ST', 'brand': 'Napoleon'},
         'Napoleon/Galaxy-series-manual.pdf'),
        ({'manufacturerSKU': 'GDS28-1NE', 'brand': 'Napoleon'},
         'Napoleon/Haliburton-Series-Manual.pdf'),
        ({'manufacturerSKU': 'GDS50-1NE', 'brand': 'Napoleon'},
         'Napoleon/Havelock-Series-Manual.pdf'),
        ({'manufacturerSKU': 'HD81NT-1', 'brand': 'Napoleon'},
         'Napoleon/HD81-1-Installation-Operation-Manual--CSA-.pdf'),
        ({'manufacturerSKU': 'NZ6000-1', 'brand': 'Napoleon'},
         'Napoleon/NZ6000-1-Manual.pdf'),
        ({'manufacturerSKU': 'NZ7000', 'brand': 'Napoleon'},
         'Napoleon/High-Country-Series-Manual1.pdf'),
        ({'manufacturerSKU': '1400ML', 'brand': 'Napoleon'},
         'Napoleon/1100P-C_1400P-C.pdf'),
        ({'manufacturerSKU': 'GT8NSB', 'brand': 'Napoleon'},
         'Napoleon/GT8-Manual--CSA-.pdf'),
        ({'manufacturerSKU': 'LVX38N2X-1', 'brand': 'Napoleon'},
         'Napoleon/Luxuria-Series-Installation-Manual.pdf'),
        ({'manufacturerSKU': 'LVX74NX-1', 'brand': 'Napoleon'},
         'Napoleon/Luxuria-Series-Installation-Manual.pdf'),
        ({'manufacturerSKU': 'EPI-1101M', 'brand': 'Napoleon'},
         'Napoleon/EPI-1101-1402-Manual.pdf'),
        ({'manufacturerSKU': 'EPI-1402K', 'brand': 'Napoleon'},
         'Napoleon/EPI-1101-1402-Manual.pdf'),
        ({'manufacturerSKU': 'EPI-1402M', 'brand': 'Napoleon'},
         'Napoleon/EPI-1101-1402-Manual.pdf'),
        ({'manufacturerSKU': 'GDIG3N', 'brand': 'Napoleon'},
         'Napoleon/Oakville--3---3E---G3---X3-Installation-Manual.pdf'),
        ({'manufacturerSKU': 'GPFN-2', 'brand': 'Napoleon'},
         'Napoleon/Patioflame-manual-GPFG.pdf'),
        ({'manufacturerSKU': 'GPFGP-1', 'brand': 'Napoleon'},
         'Napoleon/Patioflame-manual-GPFG.pdf'),
        ({'manufacturerSKU': 'WHD48N', 'brand': 'Napoleon'},
         'Napoleon/WHD48_Plazmafire_48_Installation_Manual.pdf'),
        ({'manufacturerSKU': 'WHD31NSB', 'brand': 'Napoleon'},
         'Napoleon/WHD31_Plazmafire_31_Installation_Manual.pdf'),
        ({'manufacturerSKU': 'WHVF24N', 'brand': 'Napoleon'},
         'Napoleon/WHVF24.pdf'),
        ({'manufacturerSKU': 'WHVF31N', 'brand': 'Napoleon'},
         'Napoleon/WHVF31_Plazmafire_Vent_Free_Installation_Manual.pdf'),
        ({'manufacturerSKU': 'GDI-30NSB', 'brand': 'Napoleon'},
         'Napoleon/GDI-30NSB_Roxbury_Series_Installation_Manual.pdf'),
        ({'manufacturerSKU': 'S1', 'brand': 'Napoleon'},
         'Napoleon/S1_S4_S9_pedestal_model.pdf'),
        ({'manufacturerSKU': 'S4', 'brand': 'Napoleon'},
         'Napoleon/S1_S4_S9_pedestal_model.pdf'),
        ({'manufacturerSKU': 'S9', 'brand': 'Napoleon'},
         'Napoleon/S1_S4_S9_pedestal_model.pdf'),
        ({'manufacturerSKU': 'NEFP27-0815W', 'brand': 'Napoleon',
          'c__series': 'Adele'},
         'Napoleon/NEFE27-0815W_Adele-Electric-Series-Fireplace-Manual.pdf'),
        ({'manufacturerSKU': 'NEFP42-1815B', 'brand': 'Napoleon'},
         'Napoleon/Allure_Series_Installation_Manual_NEFL.pdf'),
        ({'manufacturerSKU': 'NEFP27-3116B', 'brand': 'Napoleon'},
         'Napoleon/NEFE27-3116B.pdf'),
        ({'manufacturerSKU': 'NEFP29-1215BW', 'brand': 'Napoleon',
          'c__series': 'Braxton'},
         'Napoleon/NEFM29-1215BW_NEFM29-1215W_Braxton-Series-Manual.pdf'),
        ({'manufacturerSKU': 'NEFP27-1116B', 'brand': 'Napoleon'},
         'Napoleon/NEFP27-1015B.pdf'),
        ({'manufacturerSKU': 'NEFP27-1015B', 'brand': 'Napoleon'},
         'Napoleon/NEFP27-1015B.pdf'),
        ({'manufacturerSKU': 'NEFP42-1715BW', 'brand': 'Napoleon'},
         'Napoleon/Allure_Series_Installation_Manual_NEFL.pdf'),
        ({'manufacturerSKU': 'NEFP33-0214W', 'brand': 'Napoleon'},
         'Napoleon/NEFM33-0114M_NEFM33-0214_Taylor-Electric-Fireplace-Mantel-Manual.pdf'),
        ({'manufacturerSKU': 'NEFP24-0516GRW', 'brand': 'Napoleon'},
         'Napoleon/NEFE24-0516GRW.pdf'),
        ({'manufacturerSKU': 'NEFB30GL', 'brand': 'Napoleon'},
         'Napoleon/NEFB30GL.pdf'),
        ({'manufacturerSKU': 'LV50N2-2', 'brand': 'Napoleon'},
         'Napoleon/Vector-Series-Installation-Manual.pdf'),
        ({'manufacturerSKU': 'NEFI18H', 'brand': 'Napoleon'},
         'Napoleon/Woodland-Log-Set-Insert-Manual.pdf'),
        ({'manufacturerSKU': 'NEFI24H', 'brand': 'Napoleon'},
         'Napoleon/Woodland-Electric-Series-Manual.pdf'),

        ({'manufacturerSKU': 'ODLVF60ZEN', 'brand': 'Superior'},                            # Superior
         'Superior/Superior_VRE4600_Installation_manual_updated.pdf'),
        ({'manufacturerSKU': 'ODLVF48ZEN', 'brand': 'Superior'},
         'Superior/Superior_VRE4600_Installation_manual_updated.pdf'),
        ({'manufacturerSKU': 'WRE3036WS', 'brand': 'Superior'},
         'Superior/SUPERIOR_WRE3036_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'ERT3027', 'brand': 'Superior'},
         'Superior/ERT3027_Spark27_Electric_FP_IICO.pdf'),
        ({'manufacturerSKU': 'MPE-33-3', 'brand': 'Superior'},
         'Superior/900974-00_A_IHP_Capella33-36_ERT3033-36_MPE-33-36_IICO.pdf'),
        ({'manufacturerSKU': 'MPE-36-3', 'brand': 'Superior'},
         'Superior/900974-00_A_IHP_Capella33-36_ERT3033-36_MPE-33-36_IICO.pdf'),
        ({'manufacturerSKU': 'VCM3026ZTN', 'brand': 'Superior'},
         'Superior/VCM3026_ZTN-P_VF_Compact_FP_SIT-TSTAT_IICO.pdf'),
        ({'manufacturerSKU': 'DRT3035DEN-C', 'brand': 'Superior'},
         'Superior/DRT3000-C_35-40-45_DEN-DEP_DV_FP_SIT-MV_SIT-PF_IICO.pdf'),
        ({'manufacturerSKU': 'ODLVF36ZEN', 'brand': 'Superior'},
         'Superior/Superior_VRE4600_Installation_manual_updated.pdf'),
        ({'manufacturerSKU': 'VRT2536WS', 'brand': 'Superior'},
         'Superior/900853-00_D_SUP_VRT2536WS_VRT2542WS_VF_Firebox_IICO.pdf'),
        ({'manufacturerSKU': 'VRT3136WS', 'brand': 'Superior'},
         'Superior/900849-00_D_SUP_VRT3100_32-36-42_WS-F_IICO.pdf'),
        ({'manufacturerSKU': 'VRT3232WS', 'brand': 'Superior'},
         'Superior/900975-00_A_SUP_VRT3200_32-36-42_WS-WH_VF_Firebox_IICO.pdf'),
        ({'manufacturerSKU': 'VRT3542WS', 'brand': 'Superior'},
         'Superior/900238-01_E_SUP_VRT3536-42_VF_Fireboxes_IICO.pdf'),
        ({'manufacturerSKU': 'VRT4032ZEN', 'brand': 'Superior'},
         'Superior/VRT-VCT4000_ZEN-ZEP_VF_Fireplace_ECO_IICO.pdf'),
        ({'manufacturerSKU': 'VRT4550WS', 'brand': 'Superior'},
         'Superior/126700-01_SUP_VRT4500_VF_Universal_Firebox_IICO_Remove_Red_Liner.indd.pdf'),
        ({'manufacturerSKU': 'VRT6036', 'brand': 'Superior'},
         'Superior/901009-00_B_SUP_VRT60364250_VF_Masonry_FB_IICO.pdf'),
        ({'manufacturerSKU': 'VRT6042', 'brand': 'Superior'},
         'Superior/901009-00_B_SUP_VRT60364250_VF_Masonry_FB_IICO.pdf'),
        ({'manufacturerSKU': 'VRT6050', 'brand': 'Superior'},
         'Superior/901009-00_B_SUP_VRT60364250_VF_Masonry_FB_IICO.pdf'),
        ({'manufacturerSKU': 'VRE3236ZENWS', 'brand': 'Superior'},
         'Superior/900990-00_E_SUP_VRE3236-42_ZEN-ZEP_WS-WH_OD_VF_FP_AMF-EL_IICO.pdf'),
        ({'manufacturerSKU': 'VRE4236WS', 'brand': 'Superior'},
         'Superior/900991-00_A_SUP_VRE4200_36-42_WS-WH_OD_VF_Firebox_IICO_CLEAN.pdf'),
        ({'manufacturerSKU': 'VRE4536WS', 'brand': 'Superior'},
         'Superior/127029-01_G_SUP_VRE45364250_OD_VF_FB_IICO.pdf'),
        ({'manufacturerSKU': 'VRE4543EN', 'brand': 'Superior'},
         'Superior/127035-01_K_SUP_VRE4543_EN-EP_OD_Linear_Gas_FP_AMF-EL_IICO.pdf'),
        ({'manufacturerSKU': 'VRE4550WS', 'brand': 'Superior'},
         'Superior/127029-01_G_SUP_VRE45364250_OD_VF_FB_IICO.pdf'),
        ({'manufacturerSKU': 'VRE6042', 'brand': 'Superior'},
         'Superior/901010-00_B_SUP_VRE60364250_VF_Masonry_FB_IICO.pdf'),
        ({'manufacturerSKU': 'BRT40STTMN', 'brand': 'Superior'},
         'Superior/900301-00_F_SUP_BRT40ST_BV_Fireplace_SIT-MV_IICO.pdf'),
        ({'manufacturerSKU': 'BRT4536TEN-B', 'brand': 'Superior'},
         'Superior/126737-01_E_SUP_BRT4036-42TEN-P__BRT4336-42TEN-P__BRT4536-42TEN-P_BV_FP_IICO.pdf'),
        ({'manufacturerSKU': 'DRC3540DEN-B', 'brand': 'Superior'},
         'Superior/900905-00_A_SUP_DRC3500_35-40-45_DV_FP_ECO_IICO.pdf'),
        ({'manufacturerSKU': 'DRC6345TEN', 'brand': 'Superior'},
         'Superior/900343-01_H_SUP_DRT-DRC6300_40-45_TEN(P)_IICO.pdf'),
        ({'manufacturerSKU': 'DRI2027TEN', 'brand': 'Superior'},
         'Superior/900787-04_G_SUP_DRI2027-32_DV_Insert_ECO_EN_IICO.pdf'),
        ({'manufacturerSKU': 'DRI2032TEN', 'brand': 'Superior'},
         'Superior/900787-04_G_SUP_DRI2027-32_DV_Insert_ECO_EN_IICO.pdf'),
        ({'manufacturerSKU': 'DRL3054TEN', 'brand': 'Superior'},
         'Superior/SUPERIOR_DRL3000_INSTALLATION_MANUAL.pdf'),
        ({'manufacturerSKU': 'DRL4060TEN', 'brand': 'Superior'},
         'Superior/DRL4060TEN DV FP Manual 900926-00.pdf'),
        ({'manufacturerSKU': 'DRL4060TEN-B', 'brand': 'Superior'},
         'Superior/901080-00_D_SUP_DRL4000_60-72-84_TEN-B_DV_FPs_SIT-PF1_IICO.pdf'),
        ({'manufacturerSKU': 'DRL6060TEN', 'brand': 'Superior'},
         'Superior/DRL6060TEN Manual 901027-00.pdf'),
        ({'manufacturerSKU': 'DRL6060TEN-B', 'brand': 'Superior'},
         'Superior/DRL6060TEN-B Manual 901052-00.pdf'),
        ({'manufacturerSKU': 'DRT3035DEN-C', 'brand': 'Superior'},
         'Superior/DRT3000-C_35-40-45_DEN-DEP_DV_FP_SIT-MV_SIT-PF_IICO.pdf'),
        ({'manufacturerSKU': 'DRT3045TEN', 'brand': 'Superior'},
         'Superior/900285-00_K_SUP_DRC3000_DRT3000_DV_Fireplace_ECO_IICO.pdf'),
        ({'manufacturerSKU': 'DRT35PFDEN', 'brand': 'Superior'},
         'Superior/DRT35ST-PF_(MPD35ST-PF)_DV_Fireplace_IICO.pdf'),
        ({'manufacturerSKU': 'DRT40CLDEN', 'brand': 'Superior'},
         'Superior/DRT40ST-PF-CR_CL_SIT-MV_HNY-EL_IICO.pdf'),
        ({'manufacturerSKU': 'DRT4245TEN', 'brand': 'Superior'},
         'Superior/DRT4200-B_40-45_DVA_FPs_ECO_IICO.pdf'),
        ({'manufacturerSKU': 'DRT4245TEN-C', 'brand': 'Superior'},
         'Superior/901032-00_B_SUP_DRT4000-C_DRT4200-C_40-45_DV_FPs_SIT-PF_IICO.pdf'),
        ({'manufacturerSKU': 'DRT63STTEN', 'brand': 'Superior'},
         'Superior/900355-01_E_SUP_DRT63ST_DV_FPs_SIT-PF2_8DVL_IICO.pdf'),
        ({'manufacturerSKU': 'VRL4543TEN', 'brand': 'Superior'},
         'Superior/126861-01_P_SUP_VRL4543_ZEN-ZEP_VF_Gas_FP_AMF-EL_IICO.pdf'),
        ({'manufacturerSKU': 'WCT4820WS', 'brand': 'Superior'},
         'Superior/900998-00_NC_SUP_WCT4820WS_(Ult-1)_EPA_FPs_EN_IICO.pdf'),
        ({'manufacturerSKU': 'WCT6820WS', 'brand': 'Superior'},
         'Superior/900087-00_F_SUP_WCT6820WS_(TRADCE)_EPA_FP_EN_IICO.pdf'),
        ({'manufacturerSKU': 'WCT6940WS', 'brand': 'Superior'},
         'Superior/900790-00_G_SUP_WCT6940WS_(TRAD)_EPA_FP_EN_IICO.pdf'),
        ({'manufacturerSKU': 'WRE3042WS', 'brand': 'Superior'},
         'Superior/127055-01_K_SUP_WRE3042_Paneled_Residential___Outdoor_WB_IICO.pdf'),
        ({'manufacturerSKU': 'WRE4550WS', 'brand': 'Superior'},
         'Superior/127017-01_H_SUP_WRE4500_Paneled_Outdoor_Wood-Burning_Fireplace_IICO.pdf'),
        ({'manufacturerSKU': 'WRE6036', 'brand': 'Superior'},
         'Superior/901008-00_C_SUP_WRE60364250_WB_Masonry_FP_IICO.pdf'),
        ({'manufacturerSKU': 'WRT2036WSI', 'brand': 'Superior'},
         'Superior/126628-01_J_SUP_WRT2036_WCT2036_Series_Wood_Fireplace__IICO.pdf'),
        ({'manufacturerSKU': 'WRT2042WSI', 'brand': 'Superior'},
         'Superior/126631-01_H_SUP_WRT2042_WCT2042_Series_Wood_Fireplace__IICO.pdf'),
        ({'manufacturerSKU': 'WRT3036WSI', 'brand': 'Superior'},
         'Superior/126619-01_K_SUP_WRT3036_Series_WCT3036_Series_Wood_Fireplace_IICO.pdf'),
        ({'manufacturerSKU': 'WRT3042WSI', 'brand': 'Superior'},
         'Superior/126622-01_L_SUP_WRT3042_Series_Wood-Burning_Fireplace_IICO.pdf'),
        ({'manufacturerSKU': 'WRT3543WS', 'brand': 'Superior'},
         'Superior/900855-00_C_SUP_WRT3538-43_WRT4038-43_WOOD-BURNING_FIREPLACE_IICO.pdf'),
        ({'manufacturerSKU': 'WRT3920WS', 'brand': 'Superior'},
         'Superior/901001-00_A_SUP_WRT3920WS_(Nova)_EPA_FPs_EN_IICO.pdf'),
        ({'manufacturerSKU': 'WRT4038IS', 'brand': 'Superior'},
         'Superior/900855-00_C_SUP_WRT3538-43_WRT4038-43_WOOD-BURNING_FIREPLACE_IICO.pdf'),
        ({'manufacturerSKU': 'WRT4550WS', 'brand': 'Superior'},
         'Superior/126601-01_K_SUP_WRT45364250_ID_WD_FP_IICO.pdf'),
        ({'manufacturerSKU': 'WRT4820WS', 'brand': 'Superior'},
         'Superior/900999-00_NC_SUP_WRT4820WS_(UltCF)_EPA_FPs_EN_IICO.pdf'),
        ({'manufacturerSKU': 'WRT4826WH', 'brand': 'Superior'},
         'Superior/901002-00_NC_SUP_WRT4826WH_(Pan)_EPA_FPs_EN_IICO.pdf'),
        ({'manufacturerSKU': 'WRT6036', 'brand': 'Superior'},
         'Superior/901007-00_C_SUP_WRT60364250_WB_Masonry_FP_IICO.pdf'),
        ({'manufacturerSKU': 'WXS2016WS', 'brand': 'Superior'},
         'Superior/900917-00_A_SUP_WXS2016_(ES2100)_Wood_Stove_EN_IICO.pdf'),
        ({'manufacturerSKU': 'WXS2021WS-B', 'brand': 'Superior'},
         'Superior/900979-00_A_SUP_WXS2021WS-B_Woodstove_EN_IICO.pdf'),

        ({'manufacturerSKU': 'EPI22-1', 'brand': 'Timberwolf'},                            # Timberwolf
         'Timberwolf/W415-2799_EPI22-1 (CSA)_CeCf_05.07.21.pdf'),
        ({'manufacturerSKU': '2200-1', 'brand': 'Timberwolf'},
         'Timberwolf/2200-1-Installation-Manual-MAR20.pdf'),
        ({'manufacturerSKU': '2100-1', 'brand': 'Timberwolf'},
         'Timberwolf/2100-1-Manual.pdf'),
        ({'manufacturerSKU': 'TPI35', 'brand': 'Timberwolf'},
         'Timberwolf/W415-0865_TPSI35.pdf'),
        ({'manufacturerSKU': 'TPS35', 'brand': 'Timberwolf'},
         'Timberwolf/W415-0865_TPSI35.pdf'),

        ({'manufacturerSKU': 'TN20.INSB', 'brand': 'True North',                            # True North
          'c__series': 'TN20 Insert'},
         'True North/100000127-TN20B-INS-110618-28.pdf'),
        ({'manufacturerSKU': 'TN24.BODYA', 'brand': 'True North',
          'c__series': 'TN24'},
         'True North/100000458_True-North24-Installation-and-User-manual-090719-40.pdf'),
        ({'manufacturerSKU': 'TN20.LEGB', 'brand': 'True North',
          'c__series': 'TN20 Stove'},
         'True North/100000064_TN20-B_110618-28.pdf'),
        ({'manufacturerSKU': 'TN10.LEGA', 'brand': 'True North',
          'c__series': 'TN10'},
         'True North/TN10_Wood_Stove_Manual.pdf'),
    ]
)
def test_find_match(item: Dict[str, str], directory: List[Dict[str, str]],
                    expect: str):
    answer = find_match(item, directory)
    if expect is None or expect == 'ignore':
        assert answer == expect
    elif isinstance(expect, set) and len(expect) > 1:
        assert any(Path(answer.relative_to(INPUT_FOLDER)) == Path(choice)
                   for choice in expect)
    else:
        assert Path(answer.relative_to(INPUT_FOLDER)) == Path(expect)

