from worker.stylist_engine import StylistEngine
e = StylistEngine()
catalog = e._get_catalog()

# Check Ao phong for kids
print("=== Áo phông kids ===")
for p in catalog:
    g = (p.get('gender') or '').lower()
    ag = (p.get('age_group') or '').lower()
    kid_kw = ['boy', 'girl', 'bé', 'trẻ em']
    if p.get('product_line') == 'Áo phông' and any(k in g+ag for k in kid_kw):
        print(f"  {p['code']} | gender={p.get('gender')} | age_group={p.get('age_group')}")

print()
print("=== Áo mặc nhà kids ===")
for p in catalog:
    g = (p.get('gender') or '').lower()
    ag = (p.get('age_group') or '').lower()
    kid_kw = ['boy', 'girl', 'bé', 'trẻ em']
    if p.get('product_line') == 'Áo mặc nhà' and any(k in g+ag for k in kid_kw):
        print(f"  {p['code']} | gender={p.get('gender')} | age_group={p.get('age_group')}")

# Also check what happens when engine computes for this code
print()
print("=== compute_dynamic_rule_matches for 2LA26S004-FA160 ===")
result = e.compute_dynamic_rule_matches('2LA26S004-FA160')
print(f"Total occasions: {len(result)}")
for occ, roles in result.items():
    for role, items in roles.items():
        print(f"  {occ} / {role}: {len(items)} items")
        for it in items[:2]:
            print(f"    - {it['code']} {it['name'][:30]}")
