import sqlite3
import os
import json

DB_PATH = "companies_v3_fixed_2.db"

def check_company_33():
    if not os.path.exists(DB_PATH):
        print(f"❌ Database not found at {DB_PATH}")
        return

    try:
        conn = sqlite3.connect(DB_PATH)
        cursor = conn.cursor()
        
        print(f"🔍 Checking Company ID 33 (Bennis Playland)...")
        # Check standard fields
        cursor.execute("SELECT id, name, city, street, zip_code FROM companies WHERE id = 33")
        row = cursor.fetchone()
        if row:
            print(f"  Standard: City='{row[2]}', Street='{row[3]}', Zip='{row[4]}'")
        else:
            print("  ❌ Company 33 not found in DB.")
            
        # Check Enrichment
        cursor.execute("SELECT content FROM enrichment_data WHERE company_id = 33 AND source_type = 'website_scrape'")
        enrich_row = cursor.fetchone()
        if enrich_row:
            data = json.loads(enrich_row[0])
            imp = data.get("impressum")
            print(f"  Impressum Data: {json.dumps(imp, indent=2) if imp else 'None'}")
        else:
            print("  ❌ No website_scrape found for Company 33.")
            
        conn.close()
    except Exception as e:
        print(f"❌ Error: {e}")

if __name__ == "__main__":
    check_company_33()
