"""
Creative Generator - Generate ideas, content, solutions
"""
import random

class CreativeGenerator:
    def __init__(self):
        self.generations = []
        
    def generate_ideas(self, topic, count=5):
        """Generate creative ideas for a topic"""
        idea_templates = [
            f"What if we combined {topic} with automation?",
            f"A new approach to {topic} using AI",
            f"Reimagining {topic} for the modern age",
            f"{topic} meets sustainable technology",
            f"Disruptive innovation in {topic}",
            f"The future of {topic} in 10 years",
            f"How to make {topic} more accessible",
            f"{topic} for social good"
        ]
        
        ideas = random.sample(idea_templates, min(count, len(idea_templates)))
        
        return {"ideas": ideas, "topic": topic}
    
    def generate_story_premise(self, genre="sci-fi"):
        """Generate a story premise"""
        characters = ["scientist", "engineer", "AI researcher", "explorer", "inventor"]
        conflicts = ["discovers breakthrough", "faces ethical dilemma", "uncovers conspiracy", 
                    "prevents disaster", "makes impossible choice"]
        settings = ["near future", "space station", "research lab", "digital world", "parallel universe"]
        
        char = random.choice(characters)
        conflict = random.choice(conflicts)
        setting = random.choice(settings)
        
        premise = f"A {char} in a {setting} {conflict}."
        
        return {"premise": premise, "genre": genre}
    
    def brainstorm_solutions(self, problem, count=5):
        """Brainstorm solutions to a problem"""
        approaches = [
            f"Break {problem} into smaller sub-problems",
            f"Apply automation to {problem}",
            f"Use data analysis to understand {problem}",
            f"Collaborate with experts on {problem}",
            f"Find analogies to {problem} in other domains",
            f"Simplify the approach to {problem}",
            f"Use iterative improvement for {problem}",
            f"Apply first principles thinking to {problem}"
        ]
        
        solutions = random.sample(approaches, min(count, len(approaches)))
        
        return {"solutions": solutions, "problem": problem}
    
    def generate_project_name(self, description):
        """Generate a creative project name"""
        prefixes = ["Project", "Operation", "Initiative", "System"]
        words = ["Phoenix", "Nexus", "Quantum", "Atlas", "Zenith", 
                "Horizon", "Catalyst", "Genesis", "Nova", "Vector"]
        
        name = f"{random.choice(prefixes)} {random.choice(words)}"
        
        return {"name": name, "description": description}

if __name__ == "__main__":
    print("CREATIVE GENERATOR TEST")
    
    creative = CreativeGenerator()
    
    # Generate ideas
    print("\n💡 Generating ideas for 'education':")
    result = creative.generate_ideas("education", 3)
    for idea in result["ideas"]:
        print(f"   - {idea}")
    
    # Generate story
    print("\n📖 Story premise:")
    result = creative.generate_story_premise("sci-fi")
    print(f"   {result['premise']}")
    
    # Brainstorm solutions
    print("\n🔧 Solutions for 'climate change':")
    result = creative.brainstorm_solutions("climate change", 3)
    for sol in result["solutions"]:
        print(f"   - {sol}")
    
    print("\n✨ Eden can now:")
    print("   - Generate creative ideas")
    print("   - Create story premises")
    print("   - Brainstorm solutions")
    print("   - Generate project names")
    
    print("\n✅ CREATIVE GENERATOR OPERATIONAL")
