<script lang="ts">
import { ae_loc } from '$lib/stores/ae_stores';
import { launcher_loc } from '$lib/stores/ae_events_stores__launcher.svelte';
import Launcher_Cfg_Section from './launcher_cfg_section.svelte';
import { IdCard } from '@lucide/svelte';
interface Props {
    on_expand?: () => void;
}
let { on_expand }: Props = $props();
</script>

<Launcher_Cfg_Section
    title="Poster Screen Saver"
    icon={IdCard}
    bind:state={launcher_loc.current.section_state__screen_saver}
    {on_expand}
    description="Idle: {(launcher_loc.current.idle_timer / 60000).toFixed(
        1
    )}m | Auto-Posters">
    <!-- Content omitted for brevity, preserved in file -->
    <div class="col-span-full flex flex-col gap-3">
        <!-- 1. Technical Timers (Edit Mode Only) -->
        {#if $ae_loc.edit_mode}
            <div class="flex flex-col gap-2">
                <p class="ml-1 text-[9px] font-bold uppercase opacity-50">
                    Screen Saver Timers (ms)
                </p>
                <div
                    class="bg-surface-500/5 border-surface-500/10 grid grid-cols-1 gap-2 rounded border p-2">
                    <div class="flex items-center justify-between gap-4">
                        <span class="text-[10px] opacity-60">Idle Wait</span>
                        <input
                            type="number"
                            min={3000}
                            bind:value={launcher_loc.current.idle_timer}
                            class="input input-sm preset-tonal-surface h-7 w-24 text-right text-[10px]" />
                    </div>
                    <div class="flex items-center justify-between gap-4">
                        <span class="text-[10px] opacity-60">Cycle Check</span>
                        <input
                            type="number"
                            min={500}
                            bind:value={launcher_loc.current.idle_cycle}
                            class="input input-sm preset-tonal-surface h-7 w-24 text-right text-[10px]" />
                    </div>
                    <div class="flex items-center justify-between gap-4">
                        <span class="text-[10px] opacity-60"
                            >Image Rotation</span>
                        <input
                            type="number"
                            min={750}
                            bind:value={launcher_loc.current.idle_loop_period}
                            class="input input-sm preset-tonal-surface h-7 w-24 text-right text-[10px]" />
                    </div>
                </div>
            </div>
        {:else}
            <!-- 2. Read Only Summary (Normal Mode) -->
            <div
                class="bg-surface-500/5 border-surface-500/10 flex flex-col gap-2 rounded-lg border p-3">
                <div class="flex items-center justify-between text-xs">
                    <span class="opacity-60">Active Idle Timeout:</span>
                    <span class="text-primary-500 font-bold"
                        >{(launcher_loc.current.idle_timer / 60000).toFixed(1)} minutes</span>
                </div>
                <p class="text-[9px] italic opacity-40">
                    The screen saver automatically rotates digital posters when
                    no activity is detected for the specified time.
                </p>
            </div>
        {/if}

        <div class="text-center">
            <p class="text-[8px] tracking-tighter uppercase italic opacity-40">
                Applies to "Poster" session types only
            </p>
        </div>
    </div>
</Launcher_Cfg_Section>
