"""Seed auction data for development."""
import asyncio
import sys
import os

# Add parent directory to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from app.database import AsyncSessionLocal
from app.services.auction_scraper import auction_scraper


async def main():
    """Seed auction data."""
    async with AsyncSessionLocal() as db:
        print("Seeding sample auction data...")
        result = await auction_scraper.seed_sample_auctions(db)
        print(f"✓ Seeded {result['found']} auctions ({result['new']} new, {result['updated']} updated)")
        
        # Also try to scrape real data
        print("\nAttempting to scrape real auction data...")
        try:
            scrape_result = await auction_scraper.scrape_all_platforms(db)
            print(f"✓ Scraped {scrape_result['total_found']} auctions from platforms:")
            for platform, stats in scrape_result['platforms'].items():
                print(f"  - {platform}: {stats.get('found', 0)} found")
            if scrape_result['errors']:
                print(f"  Errors: {scrape_result['errors']}")
        except Exception as e:
            print(f"  Scraping failed (this is okay): {e}")
    
    print("\n✓ Done!")


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