"""어구 parent name 정규화/필터 규칙."""

from __future__ import annotations

from typing import Optional

_TRACKABLE_PARENT_MIN_LENGTH = 4
_REMOVE_TOKENS = (' ', '_', '-', '%')


def normalize_parent_name(name: Optional[str]) -> str:
    value = (name or '').upper().strip()
    for token in _REMOVE_TOKENS:
        value = value.replace(token, '')
    return value


def is_trackable_parent_name(name: Optional[str]) -> bool:
    return len(normalize_parent_name(name)) >= _TRACKABLE_PARENT_MIN_LENGTH
