<?php
// ===============================
// BASIC APP SETTINGS
// ===============================
define('APP_BASE_URL', 'https://live.aiphototobooth.co.in/'); // keep trailing slash

// ===============================
// LIGHTX SETTINGS
// ===============================
define('LIGHTX_API_KEY', '655f92b16aa143d88f8507a0f99e9881_f3a19d23118b4fb5b12cbd234339239e_andoraitools');

// We already tested this endpoint works from your server ✅
define('LIGHTX_AIFILTER_URL', 'https://api.lightxeditor.com/external/api/v2/aifilter');
define('LIGHTX_ORDER_STATUS_URL', 'https://api.lightxeditor.com/external/api/v2/order-status');

// ===============================
// STORAGE PATHS
// ===============================
define('SELFIE_DIR', __DIR__ . '/uploads/selfies/');
define('OUTPUT_DIR', __DIR__ . '/uploads/generated/');

define('SELFIE_URL_BASE', APP_BASE_URL . 'uploads/selfies/');
define('OUTPUT_URL_BASE', APP_BASE_URL . 'uploads/generated/');

// ===============================
// WHATSAPP SETTINGS
// ===============================
// Number without + (example: 919876543210)
define('WHATSAPP_NUMBER', '918248557752');

// ===============================
// THEMES + AVATARS (EDIT THESE)
// thumbnails are for UI only: assets/themes/.. and assets/avatars/..
// prompt is what we send to LightX.
// ===============================
$THEMES = [
      [
        'id' => 'future_lab',
        'name' => 'Future Tech Lab',
        'thumbnail' => 'assets/themes/future_lab.jpg',
        'avatars' => [
            [
                'id' => 'cyber_engineer',
                'name' => 'Cyber Engineer',
                'thumbnail' => 'assets/avatars/cyber_engineer.jpg',
                'prompt' => 'highly detailed sci-fi portrait of the same person as a cyberpunk engineer in a neon-lit futuristic lab, glowing holographic interfaces in background, cinematic lighting, ultra sharp, 4k',
                'style_reference_url' => null, // optional: LightX styleReferenceUrl later
            ],
            [
                'id' => 'ai_scientist',
                'name' => 'AI Scientist',
                'thumbnail' => 'assets/avatars/ai_scientist.jpg',
                'prompt' => 'portrait of the same person as a confident AI scientist, white futuristic lab coat, subtle hologram circuits around, clean tech office background, soft studio lighting, ultra realistic',
                'style_reference_url' => null,
            ],
        ],
    ],
    [
        'id' => 'space_odyssey',
        'name' => 'Space Odyssey',
        'thumbnail' => 'assets/themes/space_odyssey.jpg',
        'avatars' => [
            [
                'id' => 'galactic_commander',
                'name' => 'Galactic Commander',
                'thumbnail' => 'assets/avatars/galactic_commander.jpg',
                'prompt' => 'epic portrait of the same person wearing a sleek space suit, galaxy and nebula in the background, dramatic rim lighting, cinematic, ultra detailed, 4k',
                'style_reference_url' => null,
            ],
            [
                'id' => 'space_pilot',
                'name' => 'Space Pilot',
                'thumbnail' => 'assets/avatars/space_pilot.jpg',
                'prompt' => 'portrait of the same person as a starship pilot, helmet under one arm, starship cockpit with glowing controls behind, soft sci-fi lighting, realistic style',
                'style_reference_url' => null,
            ],
        ],
    ],
    [
        'id' => 'digital_royalty',
        'name' => 'Digital Royalty',
        'thumbnail' => 'assets/themes/digital_royalty.jpg',
        'avatars' => [
            [
                'id' => 'tech_queen',
                'name' => 'Tech Queen',
                'thumbnail' => 'assets/avatars/tech_queen.jpg',
                'prompt' => 'royal portrait of the same person as a modern tech queen, digital crown made of circuits, elegant futuristic clothing, soft golden and teal lighting, premium editorial style',
                'style_reference_url' => null,
            ],
            [
                'id' => 'data_king',
                'name' => 'Data King',
                'thumbnail' => 'assets/avatars/data_king.jpg',
                'prompt' => 'portrait of the same person as a modern data king, sharp suit with subtle holographic patterns, abstract data streams in background, moody cinematic lighting',
                'style_reference_url' => null,
            ],
        ],
    ],
];

// Helpers
function get_themes(): array {
  global $THEMES;
  return $THEMES;
}

function find_avatar(string $themeId, string $avatarId): ?array {
  global $THEMES;

  foreach ($THEMES as $theme) {
    if ($theme["id"] === $themeId) {
      foreach ($theme["avatars"] as $avatar) {
        if ($avatar["id"] === $avatarId) {
          return ["theme" => $theme, "avatar" => $avatar];
        }
      }
    }
  }
  return null;
}
