#!/usr/bin/env python3

from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import json

def main():
    # Load credentials
    creds = Credentials.from_authorized_user_file('google-auth/token.json')
    
    # Build the service
    service = build('slides', 'v1', credentials=creds)
    
    # Presentation ID
    presentation_id = '1IvDHJ53PEYvge41LdLc7Tyb5U4xOmID7GjHlIYHarJY'
    
    # Get the presentation
    presentation = service.presentations().get(presentationId=presentation_id).execute()
    
    print("=== CURRENT PRESENTATION STATE ===")
    print(f"Title: {presentation.get('title')}")
    print(f"Slides count: {len(presentation.get('slides', []))}")
    print()
    
    # List all slides with their current order
    for i, slide in enumerate(presentation.get('slides', [])):
        print(f"Position {i}: {slide['objectId']}")
        
        # Get slide elements for context
        elements = slide.get('pageElements', [])
        for element in elements:
            if 'shape' in element:
                shape = element['shape']
                if 'text' in shape and 'textElements' in shape['text']:
                    for text_element in shape['text']['textElements']:
                        if 'textRun' in text_element:
                            content = text_element['textRun']['content'].strip()
                            if content and len(content) > 5:  # Skip empty/short strings
                                print(f"  - Text: {content[:100]}...")
                                break
                    break
        print()

if __name__ == "__main__":
    main()