"""Value variant selection service for metadata stage."""

from typing import List
from .random_service import DeterministicRandomService


class ValueVariantSelector:
    """Single responsibility: Select value variants deterministically."""

    def __init__(self, random_service: DeterministicRandomService):
        """
        Initialize with deterministic random service.

        Args:
            random_service: Service for consistent random operations
        """
        self.random_service = random_service

    def select_value_variant(self, values: List[str], context: str) -> str:
        """
        Select value variant deterministically.

        Args:
            values: List of possible values to select from
            context: Context string for deterministic selection

        Returns:
            Selected value from the list

        Raises:
            ValueError: If values list is empty
        """
        if not values:
            raise ValueError("Values list cannot be empty")

        # Use random service's consistent selection method
        return self.random_service.select_value_for_resource(context, values)