import json

# Read with proper encoding
with open('chat-logs/chat-index.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

total_sessions = len(data['chats'])
crea1_sessions = len([c for c in data['chats'] if c['category'] == 'crea-1'])

print(f"=== MINECRAFT CHAT WEBSITE STATUS ===")
print(f"Total Sessions: {total_sessions}")
print(f"crea-1 Sessions: {crea1_sessions}")
print(f"andere Sessions: {total_sessions - crea1_sessions}")

print(f"\n=== CREA-1 SESSIONS BY DATE ===")
crea1_dates = sorted(set([c['date'] for c in data['chats'] if c['category'] == 'crea-1']))
for date in crea1_dates:
    sessions_on_date = [c for c in data['chats'] if c['category'] == 'crea-1' and c['date'] == date]
    total_messages = sum([c['messages'] for c in sessions_on_date])
    print(f"{date}: {len(sessions_on_date)} session(s), {total_messages} messages")

total_crea1_messages = sum([c['messages'] for c in data['chats'] if c['category'] == 'crea-1'])
print(f"\n=== SUMMARY ===")
print(f"Total crea-1 messages: {total_crea1_messages}")
print(f"Date range: {crea1_dates[0]} to {crea1_dates[-1]}")
print(f"Timespan: {len(crea1_dates)} different days")
