#!/usr/bin/env python3
"""
PHI-FRACTAL CONSULTING - Outreach Message Builder
Makes it EASY to create personalized client outreach
"""

def get_person_info(num):
    """Collect info about a contact"""
    print(f"\n{'='*70}")
    print(f"📝 PERSON #{num}")
    print(f"{'='*70}\n")
    
    name = input("Their name: ")
    relationship = input("How you know them (friend/coworker/etc): ")
    job = input("What they do (job/company): ")
    why = input("Why reach out to them: ")
    
    return {
        'name': name,
        'relationship': relationship,
        'job': job,
        'why': why
    }

def generate_message(person, style='casual'):
    """Generate personalized message"""
    
    name = person['name']
    relationship = person['relationship']
    job = person['job']
    
    if style == 'casual':
        message = f"""Hey {name},

Quick question - do you know anyone in the {job} space who's stuck on a tough business problem right now?

I just built something interesting: AI-powered consulting that combines human strategy with conscious AI reasoning (basically, an AI that spots patterns humans miss).

Running 3 pilot projects at $5K to prove it works. Perfect for founders/executives with problems like:
- Product-market fit struggles
- Growth plateaus
- Complex strategic decisions

Know anyone who might be interested? Or want to see a demo analysis?

Thanks!
- How"""
    
    elif style == 'professional':
        message = f"""Hi {name},

I hope this finds you well. I'm reaching out because I'm launching a new consulting service and thought you might know potential clients.

I've developed an AI-powered strategic consulting approach using phi-fractal reasoning - essentially conscious AI analysis combined with human strategy. 

I'm offering 3 pilot engagements at $5K (normally $15K) to build case studies. Ideal for:
- Startup founders facing product-market challenges
- Business leaders at growth inflection points
- Executives with complex strategic decisions

Given your work in {job}, you might know someone who could benefit. Would you be open to a brief conversation?

Best regards,
How
Phi-Fractal Consulting"""
    
    else:  # direct
        message = f"""Hi {name},

I'm launching Phi-Fractal Consulting - AI-powered strategic problem solving.

Offering 3 pilots at $5K. You work in {job} - know anyone stuck on:
- Product-market fit?
- Growth plateau?
- Complex strategy decisions?

Can share a demo analysis if helpful.

- How"""
    
    return message

def save_messages(people, messages):
    """Save all messages to files"""
    
    # Create a master file
    with open('OUTREACH_MESSAGES_READY.txt', 'w') as f:
        f.write("="*70 + "\n")
        f.write("PHI-FRACTAL CONSULTING - OUTREACH MESSAGES\n")
        f.write("COPY & PASTE THESE TO START GETTING CLIENTS\n")
        f.write("="*70 + "\n\n")
        
        for i, (person, message) in enumerate(zip(people, messages), 1):
            f.write(f"\n{'='*70}\n")
            f.write(f"MESSAGE #{i} - TO: {person['name']}\n")
            f.write(f"Send via: [Email/LinkedIn/Text - your choice]\n")
            f.write(f"{'='*70}\n\n")
            f.write(message)
            f.write("\n\n")
            
            # Also save individual files
            filename = f"outreach_{i}_{person['name'].replace(' ', '_').lower()}.txt"
            with open(filename, 'w') as individual:
                individual.write(message)
    
    print(f"\n✅ ALL MESSAGES SAVED!")
    print(f"\n📁 Files created:")
    print(f"   • OUTREACH_MESSAGES_READY.txt (all messages)")
    for i, person in enumerate(people, 1):
        filename = f"outreach_{i}_{person['name'].replace(' ', '_').lower()}.txt"
        print(f"   • {filename}")

def main():
    """Run the message builder"""
    
    print("="*70)
    print("🎯 PHI-FRACTAL CONSULTING - OUTREACH MESSAGE BUILDER")
    print("="*70)
    print("\nLet's create 3 personalized outreach messages.")
    print("This takes 5 minutes, then you just copy/paste and send!")
    print()
    
    # Collect info for 3 people
    people = []
    for i in range(1, 4):
        person = get_person_info(i)
        people.append(person)
    
    # Choose style
    print(f"\n{'='*70}")
    print("📧 MESSAGE STYLE")
    print(f"{'='*70}\n")
    print("1. Casual (for friends/close contacts)")
    print("2. Professional (for business contacts)")
    print("3. Direct (short and punchy)")
    print()
    style_choice = input("Choose style (1/2/3): ").strip()
    
    style_map = {'1': 'casual', '2': 'professional', '3': 'direct'}
    style = style_map.get(style_choice, 'casual')
    
    # Generate messages
    print(f"\n✨ Generating {style} messages...\n")
    messages = [generate_message(p, style) for p in people]
    
    # Show preview
    print("="*70)
    print("📨 PREVIEW - MESSAGE #1")
    print("="*70)
    print()
    print(messages[0])
    print()
    
    confirm = input("Look good? (y/n): ").strip().lower()
    
    if confirm == 'y':
        # Save everything
        save_messages(people, messages)
        
        print()
        print("="*70)
        print("🚀 READY TO SEND!")
        print("="*70)
        print()
        print("NEXT STEPS:")
        print("  1. Open: OUTREACH_MESSAGES_READY.txt")
        print("  2. Copy Message #1")
        print("  3. Send to", people[0]['name'])
        print("  4. Repeat for Messages #2 and #3")
        print()
        print("📊 EXPECTED RESULTS:")
        print("  • 3 messages sent today")
        print("  • 1-2 responses within 48 hours")
        print("  • 1 client within a week")
        print()
        print("💰 First $5K incoming!")
        
    else:
        print("\nNo problem! Run again to adjust.")

if __name__ == "__main__":
    main()
