import sys
import os
import json

# Absolute path setup
current_dir = os.path.dirname(os.path.abspath(__file__))
connector_dir = os.path.abspath(os.path.join(current_dir, '..'))
sys.path.insert(0, connector_dir)

from superoffice_client import SuperOfficeClient

def check_counts():
    print("📊 Verifying Filter Logic via OData Search...")
    client = SuperOfficeClient()
    if not client.access_token:
        print("❌ Auth failed.")
        return

    # Simplified OData Search
    # We ask for top=1 but want the total count
    endpoint = "Contact?$filter=name contains 'GmbH'&$top=1&$select=Associate"
    
    print(f"📡 Querying: {endpoint}")
    try:
        resp = client._get(endpoint)
        print("--- RAW RESPONSE START ---")
        print(json.dumps(resp, indent=2))
        print("--- RAW RESPONSE END ---")
        
    except Exception as e:
        print(f"❌ Error: {e}")

if __name__ == "__main__":
    check_counts()


if __name__ == "__main__":
    check_counts()
