"""
Customer Number Normalizer

Normalizes customer numbers (alphanumeric codes).
"""

from .base import BaseNormalizer


class CustomerNumberNormalizer(BaseNormalizer):
    """
    Normalizes customer numbers.

    Customer numbers can have various formats:
    - Alphanumeric codes: 'EMM 256-6', 'ABC123', 'A-1234'
    - Pure numbers: '12345', '123-456'

    Examples:
        'EMM 256-6' -> ['EMM 256-6', 'EMM256-6', 'EMM2566']
        'ABC 123' -> ['ABC 123', 'ABC123']
    """

    def normalize(self, value: str) -> list[str]:
        """Generate variants of customer number."""
        value = self.clean_text(value)
        variants = [value]

        # Version without spaces
        no_space = value.replace(' ', '')
        if no_space != value:
            variants.append(no_space)

        # Version without dashes
        no_dash = value.replace('-', '')
        if no_dash != value:
            variants.append(no_dash)

        # Version without spaces and dashes
        clean = value.replace(' ', '').replace('-', '')
        if clean != value and clean not in variants:
            variants.append(clean)

        # Uppercase and lowercase versions
        if value.upper() != value:
            variants.append(value.upper())
        if value.lower() != value:
            variants.append(value.lower())

        return list(set(v for v in variants if v))
