"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-05 22:40:12.065056
"""

```python
class ReasoningEngine:
    """
    A simple reasoning engine that solves a specific problem involving limited reasoning sophistication.
    
    This engine is designed to handle rules in the form of if-else statements and apply them to given conditions.
    It is particularly useful for scenarios where logical decisions need to be made based on predefined criteria.
    """

    def __init__(self, rules: list):
        """
        Initialize the ReasoningEngine with a set of rules.

        :param rules: A list of tuples representing if-else logic. Each tuple contains conditions and the corresponding action as a function or value.
        """
        self.rules = rules

    def apply_rules(self, data: dict) -> str:
        """
        Apply the defined rules to the given input data and return the result based on the first matching rule.

        :param data: A dictionary containing the values for the conditions in the rules.
        :return: The action (value or function call result) from the first matched rule.
        """
        for condition, action in self.rules:
            if all(data.get(key) == value for key, value in condition.items()):
                return action
        raise ValueError("No matching rule found")

# Example usage

def handle_order(order_data: dict) -> str:
    """
    A function to be called when a specific order condition is met.
    """
    print(f"Handling order {order_data['id']}")
    return "Order processed"

def handle_payment(payment_data: dict) -> str:
    """
    A function to be called when a specific payment condition is met.
    """
    print(f"Processing payment for item {payment_data['item_id']}")
    return "Payment received"

# Define rules
rules = [
    ({'order_type': 'urgent', 'status': 'new'}, handle_order),
    ({'payment_method': 'credit_card', 'amount': 100}, handle_payment)
]

# Initialize the engine with rules
reasoning_engine = ReasoningEngine(rules)

# Example data to test the reasoning engine
example_data = {
    'order_type': 'urgent',
    'status': 'new',
    'payment_method': 'credit_card',
    'amount': 150,
    'item_id': 'xyz123'
}

# Apply rules and get result
result = reasoning_engine.apply_rules(example_data)
print(result)
```