from ...common import (CONFIGURATION_PATTERN, COMPONENT_PATTERN, CONFIGURATION_BEFORE_STOP_WORDS,
                       COMPONENT_AFTER_STOP_WORDS, ATTACKER_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 root_cause
COMPONENT_CONFIG_CAUSE_PATTERN = (r'(?:The |)' + COMPONENT_PATTERN + COMPONENT_AFTER_STOP_WORDS
                                     + CONFIGURATION_BEFORE_STOP_WORDS + CONFIGURATION_PATTERN
                                     + ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN)

# component config root_cause attacker impact vector
DETAILS_6_1 = (COMPONENT_CONFIG_CAUSE_PATTERN + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN +
               ATTACKER_AFTER_STOP_WORDS + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + VECTOR_BEFORE_STOP_WORDS +
               VECTOR_PATTERN + r'\.$')

# component config root_cause attacker impact
DETAILS_5_1 = (COMPONENT_CONFIG_CAUSE_PATTERN + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN +
               ATTACKER_AFTER_STOP_WORDS + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + r'\.$')


COMPONENT_CONFIG_CAUSE_PATTERNS = {
    '6_1': DETAILS_6_1,
    '5_1': DETAILS_5_1,
}
