#!/usr/bin/env python3
"""
PsychologyEngine v2 – Natürliche, situationsbewusste Kommunikation
Nutzt NaturalLanguageEngine für authentischen Ausdruck
"""

import json
import os
import sys

# NaturalLanguageEngine importieren
sys.path.insert(0, os.path.expanduser("~/natiris/core"))
from NaturalLanguageEngine import generate_response, load_json, PATHS

def generate_response(user_input, state=None):
    """Generiert authentische, nicht-bot-artige Antwort"""
    if state is None:
        state = load_json(PATHS["state"])
    
    return generate_response(user_input, state)

def load_state():
    return load_json(PATHS["state"])

if __name__ == "__main__":
    # Test
    print("PsychologyEngine v2 – Test Mode")
    state = load_state()
    print(f"Current Trust: {state.get('trust', 'N/A')}")
    print("-" * 50)
    
    while True:
        try:
            user_in = input("\nYou: ")
            if user_in.lower() in ["quit", "exit", "q"]:
                break
            response = generate_response(user_in, state)
            print(f"Natiris: {response}")
            # Update state für nächste Runde
            state = load_state()
        except KeyboardInterrupt:
            break
        except Exception as e:
            print(f"Fehler: {e}")
