import db
import os

def seed_portfolio():
    print("Seeding portfolio...")
    # Portfolio items are order_photos with is_public = TRUE
    # Since they don't necessarily need an order, we can set order_id to NULL
    # But let's check if the table allows it
    
    portfolio_items = [
        {"path": "/uploads/portfolio/gear.png"},
        {"path": "/uploads/portfolio/villa.png"},
        {"path": "/uploads/portfolio/warrior.png"}
    ]
    
    for item in portfolio_items:
        # Check if already exists
        exists = db.execute_query("SELECT id FROM order_photos WHERE file_path = %s", (item["path"],))
        if not exists:
            db.execute_commit(
                "INSERT INTO order_photos (order_id, file_path, is_public) VALUES (NULL, %s, TRUE)",
                (item["path"],)
            )
            print(f"Added {item['path']} to portfolio")

if __name__ == "__main__":
    seed_portfolio()
