import asyncio

from agent.lead_stage_agent.product_search_engine import (InferredSearch, LeadSearchInput, LiteralSearch,
                                                          ProductSearchEngine)


async def main():
    engine = ProductSearchEngine()
    req = LeadSearchInput(
        inferred=InferredSearch(
            product_line_vn=["Quần lót"],
            gender_by_product="men"
        ),
        literal=LiteralSearch(raw_text="sịp nam cực sinh")
    )
    result = await engine.search(req)
    print("Tier:", result.get('tier'))
    print("Mode:", result.get('search_mode'))
    print("Count:", result.get('count'))
    for p in result.get('products', [])[:5]:
        print(p.get('sku'), p.get('name').encode('utf-8'), p.get('gender'), p.get('product_line'))

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