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-1-2/index.xml': 8.701,
    'G2-1-3_1/index.xml': 4.427,
    'G2-1-3_2/index.xml': 4.459,
    'G2-2-1/index.xml': 4.301,
    'G2-2-2/index.xml': 4.305,
    'G2-2-3/index.xml': 13.038,
    'G2-2-6/index.xml': 6.555,
    'G2-2-7/index.xml': 8.803,
    'G2-3-1_2/index.xml': 10.617,
    'G2-4-1_1/index.xml': 8.830,
    'G2-4-1_2/index.xml': 4.321,
    'G2-4-1_3/index.xml': 4.347,
    'G2-4-2_1/index.xml': 4.364,
    'G2-4-2_2/index.xml': 4.323,
    'G2-5-1_1/index.xml': 8.591,
    'G2-5-1_2/index.xml': 8.633,
    'G2-5-1_3/index.xml': 6.587,
    'G2-5-2/index.xml': 8.620,
    'G2-5-3/index.xml': 4.337,
    'G2-5-4_1/index.xml': 4.275,
    'G2-5-4_2/index.xml': 4.382,
    'G2-5-4_3/index.xml': 4.228,
    'G2-6-1_1/index.xml': 6.481,
    'G2-6-1_2/index.xml': 6.711,
    'G2-6-1_3/index.xml': 2.446,
    'G2-6-2/index.xml': 4.579,
    'G2-7-1_1/index.xml': 4.459,
    'G2-7-1_2/index.xml': 4.668,
    'G3-1-1_1/index.xml': 16.013,
    'G3-1-1_2/index.xml': 10.167,
    'G3-1-2/index.xml': 16.833,
    'G3-1-5/index.xml': 17.252,
    'G3-2-2/index.xml': 4.282,
    'G3-2-3/index.xml': 4.313,
    'G3-4-2_1/index.xml': 4.376,
    'G3-4-2_2/index.xml': 4.401,
    'G3-4-2_3/index.xml': 4.303,
    'G3-4-2_4/index.xml': 6.477,
    'G3-4-3_1/index.xml': 6.529,
    'G3-4-3_2/index.xml': 6.576,
    'G3-4-4/index.xml': 4.393,
    'G3-4-5_1/index.xml': 4.320,
    'G3-4-5_2/index.xml': 6.512,
    'G3-4-6/index.xml': 6.446,
    'G3-4-7/index.xml': 4.410,
    'G3-5-1/index.xml': 4.391,
    'RTS_Annex_III_Par_1/index.xml': 6.577,
    'RTS_Annex_III_Par_3_G3-1-3/index.xml': 2.200,
    'RTS_Annex_II_Par_1/index.xml': 6.552,
    'RTS_Annex_II_Par_1_RTS_Annex_IV_par_7/index.xml': 4.323,
    'RTS_Annex_IV_Par_11_G3-2-2/index.xml': 6.551,
    'RTS_Annex_IV_Par_12_G2-2-4/index.xml': 15.244,
    'RTS_Annex_IV_Par_14_G2-5-1/index.xml': 4.316,
    'RTS_Annex_IV_Par_1_G2-1-4/index.xml': 4.334,
    'RTS_Annex_IV_Par_2_G2-1-1/index.xml': 6.475,
    'RTS_Annex_IV_Par_4_1/index.xml': 4.316,
    'RTS_Annex_IV_Par_4_2/index.xml': 4.360,
    'RTS_Annex_IV_Par_4_G1-1-1_G3-4-5/index.xml': 11.678,
    'RTS_Annex_IV_Par_5/index.xml': 6.588,
    'RTS_Annex_IV_Par_6/index.xml': 4.328,
    'RTS_Annex_IV_Par_8_G3-4-5/index.xml': 6.459,
    'RTS_Annex_IV_Par_9_Par_10_G1-4-1_G1-4-2_G3-3-1_G3-3-2/index.xml': 17.520,
    'RTS_Art_3/index.xml': 8.643,
    'RTS_Art_6_a/index.xml': 4.175,
}.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=8,
)
