from ...common import (CONFIGURATION_PATTERN, COMPONENT_PATTERN, CONFIGURATION_BEFORE_STOP_WORDS, CONDITION_PATTERN,
                       COMPONENT_AFTER_STOP_WORDS, ATTACKER_BEFORE_STOP_WORDS, CONDITION_BEFORE_STOP_WORDS,
                       ATTACKER_PATTERN, ATTACKER_AFTER_STOP_WORDS, IMPACT_BEFORE_STOP_WORDS, IMPACT_PATTERN,
                       VECTOR_BEFORE_STOP_WORDS, VECTOR_PATTERN, ROOT_CAUSE_BEFORE_STOP_WORD, ROOT_CAUSE_PATTERN)


# component config attacker
COMPONENT_CONFIG_ATTACKER_PATTERN = (r'(?:The |)' + COMPONENT_PATTERN + COMPONENT_AFTER_STOP_WORDS
                                     + CONFIGURATION_BEFORE_STOP_WORDS + CONFIGURATION_PATTERN
                                     + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN + ATTACKER_AFTER_STOP_WORDS)

# component config attacker impact vector root_cause
DETAILS_6_1 = (COMPONENT_CONFIG_ATTACKER_PATTERN + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN +
               VECTOR_BEFORE_STOP_WORDS + VECTOR_PATTERN + ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN + r'\.$')

# component config attacker impact vector condition
DETAILS_6_2 = (COMPONENT_CONFIG_ATTACKER_PATTERN + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN +
               VECTOR_BEFORE_STOP_WORDS + VECTOR_PATTERN + CONDITION_BEFORE_STOP_WORDS + CONDITION_PATTERN + r'\.$')

# component config attacker impact vector
DETAILS_5_1 = (COMPONENT_CONFIG_ATTACKER_PATTERN + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN +
               VECTOR_BEFORE_STOP_WORDS + VECTOR_PATTERN + r'\.$')

# component config attacker impact root_cause
DETAILS_5_2 = (COMPONENT_CONFIG_ATTACKER_PATTERN + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN +
               ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN + r'\.$')


COMPONENT_CONFIG_ATTACKER_PATTERNS = {
    '6_1': DETAILS_6_1,
    '6_2': DETAILS_6_2,
    '5_1': DETAILS_5_1,
    '5_2': DETAILS_5_2
}
