<?php
/**
 * lib/themes.php — Names of the 6 glass themes (panel index 0..5).
 *
 * NOTE: The panel index is NOT sequential with the app layout. The actual chain is:
 *   panel index --IBO_THEME_MAP--> IBO value (1..6) --ThemeChooser--> activity_home_N.
 * Verified map (code + Waydroid):
 *   idx0 -> v1 -> activity_home     : bento launcher (no TMDB photos)
 *   idx1 -> v4 -> activity_home_2   : hero + Continue Watching + Trending
 *   idx2 -> v2 -> activity_home_4   : side cards + featured hero panel (right)
 *   idx3 -> v3 -> activity_home_3   : fullscreen backdrop + cards
 *   idx4 -> v5 -> activity_home_5   : side navigation + Recently Added rows
 *   idx5 -> v6 -> activity_home_6   : hero + Recently Added rows
 * Only theme=0 is active by default; the rest are chosen per device from the panel.
 */

declare(strict_types=1);

/**
 * Map PANEL index => theme name (describes the ACTUAL layout rendered by the app).
 *
 * @return array<int,string>
 */
function theme_names(): array
{
    return [
        0 => 'Bento — Large Live + shortcuts (no TMDB photos)',
        1 => 'Hero + Continue Watching + Trending',
        2 => 'Cards + featured hero panel',
        3 => 'Fullscreen backdrop + cards',
        4 => 'Side nav + Recently Added',
        5 => 'Hero + Recently Added',
    ];
}

/**
 * Readable name of a theme by index. Returns a fallback if the index does not exist.
 */
function theme_name(int $idx): string
{
    $names = theme_names();
    return $names[$idx] ?? ('Theme ' . $idx);
}

/**
 * Validates that a theme index is within the range 0..5.
 */
function is_valid_theme(int $idx): bool
{
    return $idx >= 0 && $idx <= 5;
}