"""
Seed About Page Data
Populates the about_content, team_members, and company_values tables
with existing data from the frontend About.js page
"""
import asyncio
from database import async_engine, AsyncSessionLocal
from models import AboutContent, TeamMember, CompanyValue
from sqlalchemy import select

async def seed_about_data():
    async with AsyncSessionLocal() as db:
        # Check if data already exists
        result = await db.execute(select(TeamMember))
        if result.scalars().first():
            print("❌ About page data already exists. Skipping seed.")
            return
        
        print("🌱 Seeding About page data...")
        
        # 1. Hero Section Content
        hero = AboutContent(
            section="hero",
            title="Your Trusted Tech Partner",
            subtitle="About PromptTech Solutions",
            content="<p>Founded in 2020, PromptTech Solutions has grown from a small repair shop to a comprehensive tech solutions provider. We combine quality products with expert services to deliver the best tech experience.</p>",
            display_order=0,
            is_active=True
        )
        db.add(hero)
        
        # 2. Our Story Content
        story = AboutContent(
            section="story",
            title="Our Story",
            subtitle="",
            content="""<p>PromptTech Solutions started with a simple vision: to make quality tech accessible and provide expert support that customers can trust. What began as a small phone repair shop has evolved into a full-service tech destination.</p>
<p>Our team of certified technicians brings decades of combined experience in electronics repair, from smartphones to laptops and everything in between. We've helped thousands of customers bring their devices back to life.</p>
<p>Today, we're proud to offer a curated selection of premium electronics alongside our repair services. Every product we sell meets our high standards for quality, and every repair we do is backed by our satisfaction guarantee.</p>""",
            display_order=0,
            is_active=True
        )
        db.add(story)
        
        # 3. Stats Section
        stats = AboutContent(
            section="stats",
            title="",
            subtitle="",
            content="",
            data={
                "stats": [
                    {"label": "Happy Customers", "value": "50,000+"},
                    {"label": "Products Sold", "value": "10,000+"},
                    {"label": "Repairs Completed", "value": "25,000+"},
                    {"label": "Years Experience", "value": "5+"}
                ]
            },
            display_order=0,
            is_active=True
        )
        db.add(stats)
        
        # 4. Team Members
        team_members = [
            TeamMember(
                name="Alex Johnson",
                role="Founder & CEO",
                bio="<p>Alex founded PromptTech Solutions with a vision to make quality tech accessible to everyone.</p>",
                image_url="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=400",
                email="",
                linkedin="",
                display_order=0,
                is_active=True
            ),
            TeamMember(
                name="Sarah Williams",
                role="Head of Operations",
                bio="<p>Sarah ensures smooth operations and exceptional customer service across all our locations.</p>",
                image_url="https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=400",
                email="",
                linkedin="",
                display_order=1,
                is_active=True
            ),
            TeamMember(
                name="Mike Chen",
                role="Lead Technician",
                bio="<p>Mike leads our team of certified technicians with over 15 years of electronics repair experience.</p>",
                image_url="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=400",
                email="",
                linkedin="",
                display_order=2,
                is_active=True
            ),
            TeamMember(
                name="Emily Davis",
                role="Customer Success",
                bio="<p>Emily is dedicated to ensuring every customer has an outstanding experience with PromptTech Solutions.</p>",
                image_url="https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=400",
                email="",
                linkedin="",
                display_order=3,
                is_active=True
            ),
        ]
        
        for member in team_members:
            db.add(member)
        
        # 5. Company Values
        values = [
            CompanyValue(
                title="Quality First",
                description="We never compromise on the quality of our products and services.",
                icon="🎯",
                display_order=0,
                is_active=True
            ),
            CompanyValue(
                title="Customer Focus",
                description="Your satisfaction is our top priority. We listen and deliver.",
                icon="👥",
                display_order=1,
                is_active=True
            ),
            CompanyValue(
                title="Excellence",
                description="We strive for excellence in everything we do.",
                icon="🏆",
                display_order=2,
                is_active=True
            ),
            CompanyValue(
                title="Integrity",
                description="Honest, transparent, and ethical business practices.",
                icon="❤️",
                display_order=3,
                is_active=True
            ),
        ]
        
        for value in values:
            db.add(value)
        
        await db.commit()
        print("✅ About page data seeded successfully!")
        print(f"   - 3 content sections created")
        print(f"   - 4 team members created")
        print(f"   - 4 company values created")

if __name__ == "__main__":
    asyncio.run(seed_about_data())
