# Future phase · Google Drive Photo Inbox

## Goal

Add a phone-friendly drag-and-drop and file-picker area where trip photos can be queued, tagged to a day or place, and uploaded into one chosen Google Drive folder. This is intentionally a future authenticated phase, not a silent upload feature.

## Proposed workflow

1. Connect a Google account through OAuth.
2. Pick or enter one Drive folder ID for the trip photo inbox.
3. Drop photos into the app or choose them from the phone photo picker.
4. Attach metadata locally: trip day, place ID, caption, favourite flag, and upload status.
5. Queue uploads locally while offline.
6. Use resumable uploads when the connection returns.
7. Store returned Drive file IDs in the trip state so the journal and post-trip visual guide can link to each photo.

## Why resumable upload

Google documents resumable upload as the suitable option for larger files and mobile situations where the connection may be interrupted. It also works for smaller files with one additional request.

## Folder targeting

Google Drive supports creating files inside a folder by supplying the folder ID in the file metadata `parents` field. The future setup page should let the user pick a folder or paste its ID, then verify access before uploads start.

## Authentication boundary

Do not place Google OAuth secrets in a static browser bundle. Use a deployment-specific Google OAuth client and the minimum practical Drive scope. Keep the existing private local-first workflow functional when Google Drive is disconnected.

## Planned implementation phases

### Phase P1 · Local photo inbox
- Drag/drop zone and iPhone photo-picker input.
- Local preview thumbnails.
- Day and place tags.
- Upload queue state in IndexedDB.
- JSON export without cloud upload.

### Phase P2 · Google Drive connection
- OAuth sign-in.
- Folder selector or folder-ID setup.
- Resumable uploads.
- Retry, pause, cancel, and duplicate-name handling.
- Returned Drive file IDs stored against the photo record.

### Phase P3 · Journal integration
- Day-page photo strip.
- Favourite-photo selection.
- Keepsake PDF and visual-guide export hooks.
- Optional couple-sync metadata through Supabase without copying the image binary into Supabase.

## Official references

- Google Drive API upload guide: https://developers.google.com/workspace/drive/api/guides/manage-uploads
- Google Drive folder guide: https://developers.google.com/workspace/drive/api/guides/folder
- Google Picker overview: https://developers.google.com/workspace/drive/picker/guides/overview
