from pathlib import PurePath
from tests.integration_tests.validation.conformance_suite_config import ConformanceSuiteConfig

TIMING = {f'tests/inline_xbrl/{k}': v for k, v in {
    'G2-6-1_3/index.xml': 2.195,
    'RTS_Annex_III_Par_3_G3-1-3/index.xml': 2.379,
    'G2-2-2/index.xml': 4.304,
    'G2-4-1_2/index.xml': 4.323,
    'G3-4-2_1/index.xml': 4.351,
    'G3-4-2_2/index.xml': 4.357,
    'G2-1-3_1/index.xml': 4.364,
    'G3-2-3/index.xml': 4.365,
    'G2-4-1_3/index.xml': 4.367,
    'G2-7-1_1/index.xml': 4.37,
    'G2-4-2_1/index.xml': 4.398,
    'G3-4-4/index.xml': 4.405,
    'G3-2-2/index.xml': 4.417,
    'RTS_Annex_II_Par_1_RTS_Annex_IV_par_7/index.xml': 4.424,
    'G2-1-3_2/index.xml': 4.426,
    'G2-2-1/index.xml': 4.429,
    'G3-5-1/index.xml': 4.443,
    'G2-6-2/index.xml': 4.449,
    'G3-4-5_1/index.xml': 4.452,
    'G3-4-7/index.xml': 4.455,
    'G2-4-2_2/index.xml': 4.458,
    'G3-4-2_3/index.xml': 4.463,
    'G2-7-1_2/index.xml': 4.471,
    'RTS_Annex_IV_Par_6/index.xml': 4.482,
    'RTS_Art_6_a/index.xml': 4.543,
    'G2-5-4_3/index.xml': 4.576,
    'G2-5-4_1/index.xml': 4.583,
    'G2-5-4_2/index.xml': 4.593,
    'RTS_Annex_IV_Par_14_G2-5-1/index.xml': 4.605,
    'RTS_Annex_IV_Par_4_2/index.xml': 4.693,
    'RTS_Annex_IV_Par_4_1/index.xml': 4.698,
    'G2-5-3/index.xml': 4.711,
    'RTS_Annex_IV_Par_1_G2-1-4/index.xml': 4.875,
    'G2-2-6/index.xml': 6.497,
    'G2-5-1_3/index.xml': 6.523,
    'G2-6-1_2/index.xml': 6.535,
    'G3-4-3_1/index.xml': 6.584,
    'G3-4-5_2/index.xml': 6.589,
    'G3-4-6/index.xml': 6.609,
    'RTS_Annex_III_Par_1/index.xml': 6.651,
    'RTS_Annex_IV_Par_5/index.xml': 6.697,
    'G3-4-2_4/index.xml': 6.711,
    'G3-4-3_2/index.xml': 6.766,
    'RTS_Annex_IV_Par_8_G3-4-5/index.xml': 6.786,
    'RTS_Annex_II_Par_1/index.xml': 6.795,
    'RTS_Annex_IV_Par_2_G2-1-1/index.xml': 6.801,
    'G2-6-1_1/index.xml': 6.869,
    'RTS_Annex_IV_Par_11_G3-2-2/index.xml': 6.914,
    'G3-1-1_2/index.xml': 6.942,
    'G2-4-1_1/index.xml': 8.7,
    'G2-2-7/index.xml': 8.708,
    'G2-5-1_1/index.xml': 8.752,
    'G2-1-2/index.xml': 8.784,
    'G2-5-1_2/index.xml': 8.835,
    'G2-5-2/index.xml': 8.907,
    'RTS_Art_3/index.xml': 9.271,
    'G2-3-1_2/index.xml': 10.986,
    'RTS_Annex_IV_Par_4_G1-1-1_G3-4-5/index.xml': 11.889,
    'G2-2-3/index.xml': 13.261,
    'G3-1-1_1/index.xml': 15.566,
    'G3-1-2/index.xml': 15.986,
    'RTS_Annex_IV_Par_12_G2-2-4/index.xml': 16.513,
    'G3-1-5/index.xml': 17.509,
    'RTS_Annex_IV_Par_9_Par_10_G1-4-1_G1-4-2_G3-3-1_G3-3-2/index.xml': 18.321,
}.items()}

config = ConformanceSuiteConfig(
    approximate_relative_timing=TIMING,
    args=[
        '--disclosureSystem', 'esef-2023',
        '--formula', 'run',
    ],
    expected_failure_ids=frozenset(f'tests/inline_xbrl/{s}' for s in [
        # Test report uses older domain item type (http://www.xbrl.org/dtr/type/non-numeric) forbidden by ESEF.3.2.2.
        'G3-1-2/index.xml:TC2_valid',
        # These tests reference zip files, which do not exist in the conformance suite.
        'G2-6-1_3/index.xml:TC2_invalid',
        'G2-6-1_3/index.xml:TC3_invalid',
        # The following test case fails because of the `tech_duplicated_facts1` formula, which incorrectly fires.
        # It does not take into account the language attribute on the fact.
        # Facts are not duplicates if their language attributes are different.
        'RTS_Annex_IV_Par_12_G2-2-4/index.xml:TC5_valid',
    ]),
    file='index_inline_xbrl.xml',
    info_url='https://www.esma.europa.eu/document/esef-conformance-suite-2023',
    local_filepath='esef_conformance_suite_2023.zip',
    name=PurePath(__file__).stem,
    plugins=frozenset({'validate/ESEF'}),
    public_download_url='https://www.esma.europa.eu/sites/default/files/2023-12/esef_conformance_suite_2023.zip',
    shards=5,
)
