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

# configuration attacker impact
CONFIG_ATTACKER_IMPACT_PATTERN = (r'(?:The |)' + CONFIGURATION_PATTERN + CONFIGURATION_AFTER_STOP_WORDS +
                                  ATTACKER_BEFORE_STOP_WORDS + ATTACKER_PATTERN + IMPACT_BEFORE_STOP_WORDS +
                                  IMPACT_PATTERN)

# configuration attacker impact root_cause vector
DETAILS_5_1 = (CONFIG_ATTACKER_IMPACT_PATTERN + ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN +
               VECTOR_BEFORE_STOP_WORDS + VECTOR_PATTERN + r'\.$')

# configuration attacker impact vector root_cause
DETAILS_5_2 = (CONFIG_ATTACKER_IMPACT_PATTERN + VECTOR_BEFORE_STOP_WORDS + VECTOR_PATTERN +
               ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN + r'\.$')

# configuration attacker impact vector condition
DETAILS_5_3 = (CONFIG_ATTACKER_IMPACT_PATTERN + VECTOR_BEFORE_STOP_WORDS + VECTOR_PATTERN +
               CONDITION_BEFORE_STOP_WORDS + CONDITION_PATTERN + r'\.$')

# configuration attacker impact root_cause
DETAILS_4_1 = CONFIG_ATTACKER_IMPACT_PATTERN + ROOT_CAUSE_BEFORE_STOP_WORD + ROOT_CAUSE_PATTERN + r'\.$'

# configuration attacker impact condition
DETAILS_4_2 = CONFIG_ATTACKER_IMPACT_PATTERN + CONDITION_BEFORE_STOP_WORDS + CONDITION_PATTERN + r'\.$'


CONFIG_ATTACKER_IMPACT_PATTERNS = {
    '5_1': DETAILS_5_1,
    '5_2': DETAILS_5_2,
    '5_3': DETAILS_5_3,
    '4_1': DETAILS_4_1,
    '4_2': DETAILS_4_2
}
