# appshell-sdk / Shell BFF config. Leave unset to keep the existing mock portal
# (the app still runs). Set these once the Shell BFF is deployed for real auth.

# Browser-safe Supabase config (the anon key is PUBLISHABLE — never service_role):
NEXT_PUBLIC_SUPABASE_URL=https://<project-ref>.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=<publishable-anon-key>

# Where the browser reaches the Shell BFF (same-origin path; rewritten to BFF_ORIGIN).
NEXT_PUBLIC_BFF_BASE_URL=/shell

# The deployed Shell BFF origin — the /shell/* rewrite proxies here (see next.config.ts).
BFF_ORIGIN=http://localhost:4000

# Installing @abe-kap/appshell-sdk (GitHub Packages) needs a read:packages token:
#   locally:  export NODE_AUTH_TOKEN=<token>   before npm install
#   Vercel:   set NODE_AUTH_TOKEN as a project env var


# ===========================================================================
# SMART GALLERY — AI routes (/api/gallery/ai/*). Full docs: docs/SMART_GALLERY.md
# ===========================================================================
#
# AUTH: these routes are session-gated. When NEXT_PUBLIC_SUPABASE_URL above is
# SET, every AI request is verified against ${BFF_ORIGIN}/api/session/context and
# a non-200 is rejected. When it is UNSET the app is in local demo mode and the
# AI routes are UNAUTHENTICATED — never expose such a deployment publicly while
# RUNPOD_API_KEY is set, or anyone can spend your GPU budget.
#
# NOTHING below is required to run the gallery: object detection, faces, OCR and
# semantic search all run FREE in-browser with no key. Only generative editing,
# transcription, denoise and tilt need RunPod.

# --- RunPod credentials -----------------------------------------------------
# Server-side ONLY. Never prefix with NEXT_PUBLIC_ — that would ship the key to
# the browser. Read exclusively by src/lib/server/runpod/client.ts.
RUNPOD_API_KEY=rpa_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# --- Per-model endpoint URLs (deploy each so the URL ends in /runsync) -------
# Several models can share one endpoint id — that is expected, not a mistake.
RUNPOD_SD_IMG2IMG_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync    # #10 prompt / colorize (img2img)
RUNPOD_SD_INPAINT_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync    # #9  replace-sky / magic-eraser / generative-fill / outpaint (masked)
RUNPOD_YOLO_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync          # #1  object detection → /api/gallery/ai/classify
RUNPOD_UPSCALE_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync       # #7  restore / upscale (Real-ESRGAN)
RUNPOD_STT_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync           # #3  speech-to-text → /api/gallery/ai/transcribe
RUNPOD_BG_REMOVE_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync     # #6  background removal (U²-Net)
RUNPOD_AUDIO_DENOISE_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync # #12 audio denoise → /api/gallery/ai/denoise
# Optional, only if you deploy them:
# RUNPOD_TILT_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync        # #2  camera tilt → /api/gallery/ai/tilt (needs the switch below)
# RUNPOD_COLORIZE_URL=https://api.runpod.ai/v2/<endpoint-id>/runsync    # #8  DDColor (currently unused — colorize goes through img2img)

# --- Which backend serves /api/gallery/ai/edit ------------------------------
# auto        = first configured of: runpod → local → huggingface → gemini
# runpod      = the RUNPOD_*_URL endpoints above (recommended)
# local       = your own Stable Diffusion (A1111/Forge/SD.Next); needs LOCAL_SD_URL
# huggingface = HF Inference API; needs HF_API_TOKEN (+ optional HF_IMAGE_MODEL)
# gemini      = Google Gemini; needs GEMINI_API_KEY (image output requires a BILLED key)
# none        = disable generative editing entirely (503 with a clear message)
AI_EDIT_PROVIDER=runpod

# Alternative backends (only read when AI_EDIT_PROVIDER selects them):
# LOCAL_SD_URL=http://127.0.0.1:7860
# LOCAL_SD_DENOISE=0.55
# LOCAL_SD_STEPS=25
# LOCAL_SD_SAMPLER=Euler a
# HF_API_TOKEN=hf_xxxxxxxx
# HF_IMAGE_MODEL=timbrooks/instruct-pix2pix
# GEMINI_API_KEY=
# GEMINI_IMAGE_MODEL=gemini-2.5-flash-image

# Optional Stable Diffusion tuning (defaults in src/lib/server/runpod/endpoints.ts):
# RUNPOD_SD_STEPS=35
# RUNPOD_SD_STRENGTH=0.8
# RUNPOD_SD_GUIDANCE=7
# RUNPOD_SD_NEGATIVE_PROMPT=

# --- Client-side capability switches (NEXT_PUBLIC_, inlined at BUILD time) ---
# Each must be the literal string "true" to enable; anything else is off. Because
# they are inlined at build time, changing one requires a rebuild, not a restart.
#
# false/unset = object detection runs FREE in-browser (COCO-SSD). true = use the
# RunPod YOLO classifier via /api/gallery/ai/classify (COCO-SSD stays the fallback).
# NEXT_PUBLIC_APG_RUNPOD_DETECT=false
#
# false/unset = background removal runs in-browser (@imgly WASM, no key).
# true = use the RunPod U²-Net endpoint, falling back to @imgly on failure.
NEXT_PUBLIC_APG_RUNPOD_BG=true
#
# true = show the editor's Auto-straighten button and call /api/gallery/ai/tilt.
# Only enable this if RUNPOD_TILT_URL is actually deployed.
# NEXT_PUBLIC_APG_RUNPOD_TILT=false

# NOTE: the photo-gallery SDK also reads a family of NEXT_PUBLIC_APG_* THEMING
# vars (NEXT_PUBLIC_APG_THEME / _ACCENT / _RADIUS / _BG_DARK / _SIDEBAR_BG_* …)
# in its standalone demo. Those are NOT used here — the CRM passes `themeTokens`
# to the gallery component directly so the gallery inherits the dashboard's
# design tokens. Setting them in this file has no effect.
