import functools
from .client import get_client

def universe_shadow(func=None, *, shadow_ratio: float = 1.0):
    """
    Decorator to shadow LLM calls within a function.
    Currently, this is a simplified implementation that assumes the function returns a string
    and we want to shadow the *input* of the function to the configured shadow model.
    
    In a real-world scenario, this would intercept the specific LLM call inside the function.
    For this demo, we'll assume the function *is* the LLM call wrapper.
    """
    if func is None:
        return functools.partial(universe_shadow, shadow_ratio=shadow_ratio)

    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        client = get_client()
        
        # 1. Execute the primary function (the "Primary Model")
        primary_result = func(*args, **kwargs)
        
        # 2. Asynchronously trigger the shadow (Fire-and-Forget)
        # In a real implementation, we'd use a background thread or task queue.
        # For this demo, we'll just log that we *would* shadow.
        # To actually shadow, we'd need to know *what* to send to the Gateway.
        # If the function takes a 'prompt', we can send that.
        
        # Example: client.shadow_request(prompt=args[0], ...)
        
        return primary_result

    return wrapper
