#!/usr/bin/env python3
"""Test rapide du parser AliExpress avec la fixture."""

from pricewatch.app.stores.aliexpress.store import AliexpressStore

# Charger la fixture (HTML avec wait)
with open("scraped/aliexpress_wait.html", "r", encoding="utf-8") as f:
    html = f.read()

url = "https://fr.aliexpress.com/item/1005007187023722.html"

store = AliexpressStore()
snapshot = store.parse(html, url)

print("=" * 80)
print("TEST PARSER ALIEXPRESS")
print("=" * 80)

print(f"\nSource: {snapshot.source}")
print(f"URL: {snapshot.url}")
print(f"Reference: {snapshot.reference}")
print(f"Title: {snapshot.title}")
print(f"Price: {snapshot.price} {snapshot.currency}")
print(f"Stock: {snapshot.stock_status}")
print(f"Images: {len(snapshot.images)} images")
for i, img in enumerate(snapshot.images[:3]):
    print(f"  [{i+1}] {img[:80]}...")
print(f"Category: {snapshot.category}")
print(f"Specs: {len(snapshot.specs)} specs")
for key, value in list(snapshot.specs.items())[:5]:
    print(f"  - {key}: {value}")

print(f"\nDebug status: {snapshot.debug.status}")
print(f"Debug errors: {len(snapshot.debug.errors)}")
for err in snapshot.debug.errors:
    print(f"  - {err}")

print(f"Debug notes: {len(snapshot.debug.notes)}")
for note in snapshot.debug.notes:
    print(f"  - {note}")

print(f"\nIs complete: {snapshot.is_complete()}")
print("=" * 80)
