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

TIMING = {f'esef_conformance_suite_2022/tests/inline_xbrl/{k}': v for k, v in {
    'G2-1-2/index.xml': 9.040,
    'G2-1-3_1/index.xml': 4.550,
    'G2-1-3_2/index.xml': 4.311,
    'G2-2-1/index.xml': 4.426,
    'G2-2-2/index.xml': 4.538,
    'G2-2-3/index.xml': 13.277,
    'G2-2-6_1/index.xml': 8.715,
    'G2-2-6_2/index.xml': 6.868,
    'G2-3-1_1/index.xml': 4.284,
    'G2-3-1_2/index.xml': 10.577,
    'G2-4-1_1/index.xml': 8.515,
    'G2-4-1_2/index.xml': 4.372,
    'G2-4-1_3/index.xml': 4.351,
    'G2-4-2_1/index.xml': 4.360,
    'G2-4-2_2/index.xml': 4.204,
    'G2-5-1_1/index.xml': 8.611,
    'G2-5-1_2/index.xml': 8.516,
    'G2-5-1_3/index.xml': 6.493,
    'G2-5-2/index.xml': 8.554,
    'G2-5-3/index.xml': 4.339,
    'G2-5-4_1/index.xml': 4.180,
    'G2-5-4_2/index.xml': 4.316,
    'G2-5-4_3/index.xml': 4.210,
    'G2-6-1_1/index.xml': 6.488,
    'G2-6-1_2/index.xml': 6.349,
    'G2-6-2/index.xml': 4.367,
    'G2-7-1_1/index.xml': 4.256,
    'G2-7-1_2/index.xml': 4.269,
    'G3-1-1_1/index.xml': 14.848,
    'G3-1-1_2/index.xml': 9.528,
    'G3-1-2/index.xml': 15.612,
    'G3-1-5/index.xml': 17.297,
    'G3-2-2/index.xml': 4.195,
    'G3-2-3/index.xml': 4.277,
    'G3-4-2_1/index.xml': 4.350,
    'G3-4-2_2/index.xml': 4.394,
    'G3-4-2_3/index.xml': 4.348,
    'G3-4-2_4/index.xml': 6.442,
    'G3-4-3_1/index.xml': 6.497,
    'G3-4-3_2/index.xml': 6.362,
    'G3-4-4/index.xml': 4.223,
    'G3-4-5_1/index.xml': 4.211,
    'G3-4-5_2/index.xml': 6.315,
    'G3-4-6/index.xml': 6.322,
    'G3-4-7/index.xml': 4.301,
    'G3-5-1/index.xml': 4.296,
    'RTS_Annex_III_Par_1/index.xml': 6.585,
    'RTS_Annex_III_Par_3_G3-1-3/index.xml': 2.199,
    'RTS_Annex_II_Par_1/index.xml': 6.449,
    'RTS_Annex_II_Par_1_RTS_Annex_IV_par_7/index.xml': 4.415,
    'RTS_Annex_IV_Par_11_G3-2-2/index.xml': 6.419,
    'RTS_Annex_IV_Par_12_G2-2-4/index.xml': 15.164,
    'RTS_Annex_IV_Par_14_G2-5-1/index.xml': 4.323,
    'RTS_Annex_IV_Par_1_G2-1-4/index.xml': 4.293,
    'RTS_Annex_IV_Par_2_G2-1-1/index.xml': 6.409,
    'RTS_Annex_IV_Par_4_1/index.xml': 4.338,
    'RTS_Annex_IV_Par_4_2/index.xml': 4.300,
    'RTS_Annex_IV_Par_4_G1-1-1_G3-4-5/index.xml': 11.494,
    'RTS_Annex_IV_Par_5/index.xml': 6.410,
    'RTS_Annex_IV_Par_6/index.xml': 4.278,
    'RTS_Annex_IV_Par_8_G3-4-5/index.xml': 6.435,
    'RTS_Annex_IV_Par_9_Par_10_G1-4-1_G1-4-2_G3-3-1_G3-3-2/index.xml': 17.047,
    'RTS_Art_3/index.xml': 8.430,
    'RTS_Art_6_a/index.xml': 4.197,
}.items()}

config = ConformanceSuiteConfig(
    approximate_relative_timing=TIMING,
    args=[
        '--disclosureSystem', 'esef-2022',
        '--formula', 'run',
    ],
    expected_failure_ids=frozenset(f'esef_conformance_suite_2022/tests/{s}' for s in [
        # The following test cases fail because of the `tech_duplicated_facts1` formula which fires
        # incorrectly because it does not take into account the language attribute on the fact.
        # A fact can not be a duplicate fact if the language attributes are different.
        'inline_xbrl/RTS_Annex_IV_Par_12_G2-2-4/index.xml:TC5_valid'
    ]),
    file='esef_conformance_suite_2022/index_inline_xbrl.xml',
    info_url='https://www.esma.europa.eu/document/esef-conformance-suite-2022',
    local_filepath='esef_conformance_suite_2022.zip',
    name=PurePath(__file__).stem,
    plugins=frozenset({'validate/ESEF'}),
    public_download_url='https://www.esma.europa.eu/sites/default/files/library/esef_conformance_suite_2022.zip',
    shards=8,
)
