from ...common import (WEAKNESS_PATTERN, WEAKNESS_AFTER_STOP_WORDS, CONFIGURATION_PATTERN, VECTOR_BEFORE_STOP_WORDS,
                       CONFIGURATION_BEFORE_STOP_WORDS, VECTOR_PATTERN, ATTACKER_BEFORE_STOP_WORDS, ATTACKER_PATTERN,
                       IMPACT_BEFORE_STOP_WORDS, IMPACT_PATTERN, CONDITION_BEFORE_STOP_WORDS, CONDITION_PATTERN,
                       CONFIGURATION_AFTER_STOP_WORDS, ROOT_CAUSE_BEFORE_STOP_WORD, ROOT_CAUSE_PATTERN)

# weakness configuration condition
WEAKNESS_CONFIG_CONDITION_PATTERN =  (r'(An |A |)' + WEAKNESS_PATTERN + WEAKNESS_AFTER_STOP_WORDS +
                                      CONFIGURATION_BEFORE_STOP_WORDS + CONFIGURATION_PATTERN +
                                      CONFIGURATION_AFTER_STOP_WORDS + CONDITION_BEFORE_STOP_WORDS + CONDITION_PATTERN)

# weakness configuration condition attacker impact vector root_cause
DETAILS_7_1 = (WEAKNESS_CONFIG_CONDITION_PATTERN + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN +
               IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + VECTOR_BEFORE_STOP_WORDS + VECTOR_PATTERN +
               ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN + r'\.$')


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


WEAKNESS_CONFIG_CONDITION_PATTERNS = {
    '7_1': DETAILS_7_1,
    '6_1': DETAILS_6_1,
}
