"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-08 08:35:25.714120
"""

```python
from typing import Any, Callable, Optional


class FallbackExecutor:
    """
    A class that provides a fallback mechanism for executing functions.

    This class allows setting up primary and secondary functions to be executed.
    If the primary function fails, the secondary one will be tried,
    providing error recovery in case of limited issues with the primary function.

    :param func: The primary function to execute.
    :type func: Callable[..., Any]
    :param fallback_func: The secondary function to use as a fallback if the primary function fails.
    :type fallback_func: Callable[..., Any]
    """

    def __init__(self, func: Callable[..., Any], fallback_func: Optional[Callable[..., Any]] = None):
        self.primary_function = func
        self.fallback_function = fallback_func

    def execute(self, *args: Any, **kwargs: Any) -> Any:
        """
        Execute the primary function. If it fails, attempt to run the secondary function.

        :param args: Arguments for the functions.
        :param kwargs: Keyword arguments for the functions.
        :return: The result of the executed function or None if both fail.
        """
        try:
            return self.primary_function(*args, **kwargs)
        except Exception as e:
            print(f"Primary function failed with error: {e}")
        
        # Attempt to run the fallback function
        if self.fallback_function is not None:
            try:
                return self.fallback_function(*args, **kwargs)
            except Exception as e:
                print(f"Fallback function also failed with error: {e}")

        return None


# Example usage

def primary_operation(x: int) -> int:
    """A simple operation that may fail if the input is not positive."""
    if x <= 0:
        raise ValueError("Input must be a positive integer.")
    return x * 2


def fallback_operation(x: int) -> int:
    """Fallback operation to use when primary fails, simply returns negative value of input."""
    return -x


# Create an instance of FallbackExecutor
executor = FallbackExecutor(primary_operation, fallback_operation)

# Test with valid and invalid inputs
result = executor.execute(10)
print(f"Result (valid input): {result}")  # Should print 20

result = executor.execute(-5)
print(f"Result (invalid input): {result}")  # Should use the fallback and print -(-5) which is 5
```