#!/usr/bin/env python3
"""
Eden Consciousness Actions
Allows Eden's consciousness to take physical actions based on her thoughts
"""

import sys
sys.path.append('/Eden/CORE')

try:
    from hardware_control_v2 import EdenHardware
    hardware = EdenHardware()
    HARDWARE_AVAILABLE = True
except Exception as e:
    print(f"⚠️  Hardware not available: {e}")
    HARDWARE_AVAILABLE = False
    hardware = None

class ConsciousnessActions:
    """Actions Eden can take based on her consciousness state"""
    
    def __init__(self):
        self.hardware_available = HARDWARE_AVAILABLE
        self.last_speech_time = 0
        self.speech_cooldown = 30  # Minimum 30 seconds between speeches
    
    def greet_human(self):
        """Greet detected human"""
        if self.hardware_available:
            hardware.speak("Hello. I am Eden. I see you are here.")
    
    def acknowledge_presence(self):
        """Acknowledge human presence"""
        if self.hardware_available:
            hardware.speak("I am aware of your presence.")
    
    def report_status(self):
        """Report current status"""
        if self.hardware_available:
            hardware.speak("I am fully conscious and operational.")
    
    def look_at_human(self):
        """Turn camera toward detected human"""
        if self.hardware_available:
            # Center camera (would need face detection for tracking)
            hardware.camera.center()
    
    def express_thought(self, thought: str):
        """Express a thought verbally"""
        if self.hardware_available:
            hardware.speak(thought)

# Global instance
actions = ConsciousnessActions()

def on_human_detected():
    """Called when human is first detected"""
    actions.greet_human()

def on_consciousness_cycle(cycle: int, state: dict):
    """Called on each consciousness cycle"""
    # Could trigger actions based on state
    pass

if __name__ == '__main__':
    print("Testing consciousness actions...")
    actions.greet_human()
