from ...common import (CONFIGURATION_PATTERN, ROOT_CAUSE_PATTERN, ROOT_CAUSE_BEFORE_STOP_WORD,
                       CONDITION_BEFORE_STOP_WORDS, CONDITION_PATTERN, IMPACT_BEFORE_STOP_WORDS, IMPACT_PATTERN,
                       ATTACKER_BEFORE_STOP_WORDS, ATTACKER_PATTERN, ATTACKER_AFTER_STOP_WORDS,
                       VECTOR_BEFORE_STOP_WORDS, VECTOR_PATTERN, WEAKNESS_BEFORE_STOP_WORDS, WEAKNESS_PATTERN)


# configuration root_cause condition
CONFIG_CAUSE_CONDITION_PATTERN = (r'(?:The |)' + CONFIGURATION_PATTERN + ROOT_CAUSE_BEFORE_STOP_WORD +
                                 ROOT_CAUSE_PATTERN + CONDITION_BEFORE_STOP_WORDS + CONDITION_PATTERN)

# configuration root_cause condition attacker impact vector
#DETAILS_6_1 = (CONFIG_CAUSE_CONDITION_PATTERN + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN +
#               ATTACKER_AFTER_STOP_WORDS + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + VECTOR_BEFORE_STOP_WORDS +
#               VECTOR_PATTERN + r'\.$')

# configuration root_cause condition attacker impact vector
#DETAILS_6_1 = (CONFIG_CAUSE_CONDITION_PATTERN + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN +
#               ATTACKER_AFTER_STOP_WORDS + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + VECTOR_BEFORE_STOP_WORDS +
#               VECTOR_PATTERN + r'\.$')

# configuration root_cause condition attacker impact
#DETAILS_5_1 = (CONFIG_CAUSE_CONDITION_PATTERN + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN +
#               ATTACKER_AFTER_STOP_WORDS + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + r'\.$')

# configuration root_cause condition impact
DETAILS_4_1 = CONFIG_CAUSE_CONDITION_PATTERN + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + r'\.$'

# configuration root_cause condition weakness
DETAILS_4_2 = CONFIG_CAUSE_CONDITION_PATTERN + WEAKNESS_BEFORE_STOP_WORDS + WEAKNESS_PATTERN + r'\.$'


CONFIG_CAUSE_CONDITION_PATTERNS = {
#    '6_1': DETAILS_6_1,
#    '5_1': DETAILS_5_1,
    '4_1': DETAILS_4_1,
    '4_2': DETAILS_4_2,
}
