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, COMPONENT_BEFORE_STOP_WORDS, COMPONENT_PATTERN,
                       ROOT_CAUSE_BEFORE_STOP_WORD, ROOT_CAUSE_PATTERN)

# weakness configuration vector
WEAKNESS_CONFIG_VECTOR_PATTERN =  (r'(An |A |)' + WEAKNESS_PATTERN + WEAKNESS_AFTER_STOP_WORDS +
                                   CONFIGURATION_BEFORE_STOP_WORDS + CONFIGURATION_PATTERN + VECTOR_BEFORE_STOP_WORDS +
                                   VECTOR_PATTERN)

# weakness configuration vector attacker impact
DETAILS_5_1 = (WEAKNESS_CONFIG_VECTOR_PATTERN + ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN +
               IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + r'\.$')

# weakness configuration vector component
DETAILS_4_1 = WEAKNESS_CONFIG_VECTOR_PATTERN + COMPONENT_BEFORE_STOP_WORDS + COMPONENT_PATTERN + r'\.$'

# weakness configuration vector root_cause
DETAILS_4_2 = WEAKNESS_CONFIG_VECTOR_PATTERN + ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN + r'\.$'

# weakness configuration vector impact
DETAILS_4_3 = WEAKNESS_CONFIG_VECTOR_PATTERN + IMPACT_BEFORE_STOP_WORDS + IMPACT_PATTERN + r'\.$'

WEAKNESS_CONFIG_VECTOR_PATTERNS = {
    '5_1': DETAILS_5_1,
    '4_1': DETAILS_4_1,
    '4_2': DETAILS_4_2,
    '4_3': DETAILS_4_3
}
